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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
LD1
Helper III
Helper III

Dax if many selectedvalue

Hi everyone, 

 

I would like to know if it's possible to create a dynamic selectedvalues. 

I mean, if I clic on " Year 2021" then i show up the formula N vs N-1 variation (2021 vs 2020), and, if i select 2020 then i can show up N vs N-1 variation too (2020 vs 2019).

 

I have already create all formula per year. I have no date in the dataset, only month and year. 

 

I tried to taste with this formula but it doesn't work:

= if(SELECTEDVALUE(Feuille1[Tps - Année])="2022", [VAR%N-1], IF(SELECTEDVALUE(Feuille1[Tps - Année]="2021",[VAR% N-1 vs N-2],IF(SELECTEDVALUE(Feuille1[Tps - Année]="2020",[VAR% N-2 vs N-3])))))
 
Can you help me please ? 
 
Thank you in advance,
 
LD

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LD1 , Not very clear. But you need measures like

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@LD1 , Not very clear. But you need measures like

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors