cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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
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.

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

@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 ?

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

@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 !!

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.

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
November Update

Check it Out!

Click here to read more about the November 2020 Updates!

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform October Community Highlights

Check out the top community contributors across all of the communities

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