Forum Discussion
Arthur_NS
4 years agoHelper I
Evolution with condition
Hi all, I have a pretty straightforward table with 3 columns: Year | Number of sales | YOY Basically what I would like to do is calculate the YoY evolution of sales. The only twist is that ...
Arthur_NS
4 years agoHelper I
Sorry but I still get the same
- Samarth_184 years agoCommunity Champion
Arthur_NS is it possible for you to share PBIX file after removing sensitive data?
- Arthur_NS4 years agoHelper I
Hello,
The pbix file can be found here: https://drive.google.com/file/d/14ff94knR1CG59264cK6_B9oZBSl1Ini3/view?usp=sharing
Also a little explanation with my table, and the calculation I'm trying to get at
Thank you
- Samarth_184 years agoCommunity Champion
Hi Arthur_NS ,
Below code would give your ideal output:-
Measure = var selected_year = int(SELECTEDVALUE(Sheet1[Year])) var _current_year_num = CALCULATE(SUM(Sheet1[Sales]),Sheet1[YoY]="YOY" && int(Sheet1[Year]) = year(TODAY())) var _current_year_deno = CALCULATE(SUM(Sheet1[Sales]),all(Sheet1[Year]), Sheet1[YoY]="YOY" && int(Sheet1[Year]) =year(TODAY())-1) var _current_year = DIVIDE(_current_year_num,_current_year_deno)-1 var _other_year_num = CALCULATE(SUM(Sheet1[Sales]),int(Sheet1[Year]) = int(selected_year)) var _other_year_deno = CALCULATE(SUM(Sheet1[Sales]),int(Sheet1[Year]) = int(selected_year)-1) var _other_year = DIVIDE(_other_year_num,_other_year_deno)-1 return IF(selected_year = YEAR(TODAY()),_current_year,_other_year)