Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey everyone!
I have a question.
I created a DAX measure, which divides two values, and gives me a percentage. This percentage changes every week. So far so good.
However what I want to achieve, is to make a compund percentage. Last weeks value added to this weeks value divided by two.
The values I would like to have is for example week 29: (-73.37) + (-72.26))/2= -73.35 Week 30: -31.99 and so on.
Is there a way to achieve this?
Thanks in advance!
Solved! Go to Solution.
For your case, you could try this way as below:
Step1:
Add an index column by yearweek column ([Year]*100+[WeekNum]) in date table.
Index = RANKX('Date',('Date'[Year]*100+'Date'[Weeknum]),,ASC,Dense)
Step2:
Use this logic to get your requirement:
Result =
(
CALCULATE (
[Your percentage measure],
FILTER ( ALL ( 'Date' ), 'Date'[Index] = MAX ( 'Date'[Index] ) - 1 )
) + [Your percentage measure]
) / 2
By the way, the result should be 29: (-73.37) + (-72.26))/2= -73.315 Week 30: -40.81 and so on
If not your case, please share your sample pbix file and expected output.
Regards,
Lin
For your case, you could try this way as below:
Step1:
Add an index column by yearweek column ([Year]*100+[WeekNum]) in date table.
Index = RANKX('Date',('Date'[Year]*100+'Date'[Weeknum]),,ASC,Dense)
Step2:
Use this logic to get your requirement:
Result =
(
CALCULATE (
[Your percentage measure],
FILTER ( ALL ( 'Date' ), 'Date'[Index] = MAX ( 'Date'[Index] ) - 1 )
) + [Your percentage measure]
) / 2
By the way, the result should be 29: (-73.37) + (-72.26))/2= -73.315 Week 30: -40.81 and so on
If not your case, please share your sample pbix file and expected output.
Regards,
Lin
After many Trials and erros, I finally got the result I want. This post gave me the basis for my sollution.
Thanks a LOT for your help!
Hi @v-lili6-msft ,
Thanks for your reply.
I did all the steps you said. Created an Index column in my Date table (which gives me the X axis). and ordered ist ascending.
Then I created mey Result measure in the original table, specifying the filters for my date table. I got some results, but not the correct values. What did I do wrong?
Index column code:
The results I got
Week 28: -0.87
Week 29: -0.86
Week 30: -0.55
Week 31: -0.98
Week 32: -0.69
Week 33: -0.68
Week 33: -0.61
...
I can sadly not sare the .pbx file. It contains sensitive inforamation...
Thanks a LOT for your help!
Use this formula separately to if it return the last week [Ist/Soll%]
Thanks again for your reply.
Maybe its helpful if I share my measures:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
78 | |
75 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |