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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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!:
The Definitive Guide to Power Query (M)

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors