Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
sudeep_92
Regular Visitor

I want to create a DAX to calculate previous 2 years

If I am selecting the current year then it will show last two year data and If not slect any year then it will show only curent and last 2 years data please help thanks in advance

Reason code202120222023
England33%27%11%
China21%46%13%
India55%31%16%
America44%78%17%
2 REPLIES 2
Greg_Deckler
Super User
Super User

@sudeep_92 You can build that logic into your measure using similar logic to this: The Complex Selector - Microsoft Fabric Community. Would need to know more about your source data to be more specific.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi thanks for your responce  but your dax is not working for me may be in near future it will help a lot.

I am sharing my current data with you.

 

RGNYearActual DemandActual forecastMape%
APAC202023025087%
NA202023420029%
Europe202045045622%
APAC202065056055%
NA202172060061%
Europe202145650041%
APAC202165776811%
NA202134541377%
Europe202254350029%
APAC202287678922%
NA202254660055%
Europe202229830081%
APAC202312315061%
NA202376575041%
Europe202334540031%
APAC202378690043%

 

In this data I want a DAx that if I select a current year from slicer then it is showing the data with current year and two previous year (i.e. select year is 2023 then data is comming like 2023, 2022 and 2021) and in this table i want to show Mape% year wise with RGN coloum.

 

Thanks in advance if you help me out  🙂

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors