cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

MY23 and MY22 DAX query

Hello, 

 

We are getting ready to import MY23 data but we are having an issue with allowing both MY23 DATA to be shown and MY22 data on the same report. The query that was previously written doesn't work with implement MY23 data 

 
MYTD = IF(or(and('Market Year Dates'[Current MY Period]='Market Year Dates'[MY Period],'Market Year Dates'[Day]<'Market Year Dates'[Current Day]),'Market Year Dates'[MY Period]<'Market Year Dates'[Current MY Period]),"Y","N")

 

Currently I have hardcoded MY as 2022 in order to only pull MY22 data because when we use the QUERY above it does not allow me to filter to MY22 data. 

 

Please let me know if it's possible how to allow end users to filter to MY22  and the new MY23 data.  

 

Thanks in advance

4 REPLIES 4
aj1973
Community Champion
Community Champion

Hi @Anonymous 

To compare Data from Year to Year, it is recommended to add a DATE_TABLE, join it to your Master table and then use Time Intelligence functions. 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Hey we have already an existing time table but when importing multiple years of data the DAX query is not able to get both years.

 

Current Market Year = IF('Market Year Dates'[Current Month]>=10,'Market Year Dates'[Current Year]+1,'Market Year Dates'[Current Year])
 
This DAX query is not working with the previous year data and NEW data coming in. 
aj1973
Community Champion
Community Champion

Not sure what you want to achieve but you need to use TI functions to get to compare data, like SAMEPERIODLASTYEAR() or DATE ADD()...

Maybe if you share your PBIX I can be more helpful.

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

hello 

 

Here is the problem MY23 data is showing up with the below DAX Query but MY22 data is not showing up.

Current Market Year = IF('Market Year Dates'[Current Month]>=10,'Market Year Dates'[Current Year]+1,'Market Year Dates'[Current Year]
 

MY23MY23MY22MY22

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors