cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Filter based on date selected and MTD/YTD

Hello guys,

 

Here is the problem I am facing.
I have a table with dates and multiple transactions per day.
I need to create a report where the user can select a specific date and a period (either MTD ither YTD).

Based on these two parameters, I should filter all the dates included in this time period.
For instance, if the user selects 15/04/2020 and MTD, it should filter and keep all the values between 01/04/2020 and 15/04/2020 in all the visuals of the report.


How can I do this filter based on these user-selected parameters ?

 

Thanks a lot for your help ! I hope the definition of the problem is clear.

 

Cheers,

 

Jay 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @jejenial ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1597312585957.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Highlighted
Super User IV
Super User IV
Community Support
Community Support

Hi @jejenial ,

 

Maybe my .pbix file can help you.

v-lionel-msft_0-1597053356889.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted

Hello @v-lionel-msft,

Thanks for your answer which helps already a lot.

The YTD works perfectly but the MTD does not and I don't know why.

 

Also, could you explain me the reason behind that line of code : 

FILTER( ALL('calendar'), 'calendar'[Date].[Year] = MAX('calendar'[Date].[Year]) ) 

 

Why do you use MAX ?

 

Thanks,

Jerome

Highlighted

@v-lionel-msft The MTD is now working, I had to adapt it but it works.

 

What I need to correct now is that the YTD is actually based on the fiscal year, starting 1st of April and not 1st of Jan. How can I do that ?

Highlighted

Hi @jejenial ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1597312585957.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

@v-lionel-msft Can you explain me the logic behind the calculation of _min_date_by_year ? 
I don't get it at atll.

 

Thanks a lot for your help !!

Highlighted

Hi @jejenial,

v-lionel-msft_0-1597396762884.png

Condition 1:

I assume that your financial year starts in April, such as (4/1/2019~3/1/2020), (4/1/2020~3/1/2021), (4/1/2021~3/1/2022)... So I marked all the dates in April.

Condition 2:

Condition 2 is to ensure that the date obtained is the date of the current financial year.

v-lionel-msft_1-1597396947930.png

In addition, MAX() here is equivalent to EARLIER().

Can the solution solve your problem?

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted

Hi @jejenial ,

 

Has your problem been solved?

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors