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.
I have the following data. [No. of Incidents per feeder_2] is a calculated measure, and TableName[Years Since Last Trim] is a dim table column. I want another measure that calculates the percentage change from [Years Since Last Trim] = 3
Years Since Last Trim | No. of Incidents per feeder_2 | Expected Value |
3 | 2.676861702 | |
4 | 3.133742331 | 17% |
5 | 3.180985109 | 19% |
6 | 3.46319797 | 29% |
7 | 3.791327913 | 42% |
8 | 3.739894552 | 40% |
9 | 4.010498688 | 50% |
10 | 4.139303483 | 55% |
How do you do this in DAX? Thanks
Solved! Go to Solution.
Never mind, I figured out. I thought it was going to be more complicated than using calculate().
#_Pct change since Yr 3 =
DIVIDE(
[No. of Incidents per feeder_2],
CALCULATE([No. of Incidents per feeder_2], 'Years Since Last Exposure'[Years Since Last Trim] = 3)
) - 1
Hi @ashamsuzzoha ,
You can create a measure as below:
#_Pct change since Yr 3 =
VAR _curfeeder =
MAX ( 'Years Since Last Exposure'[No. of Incidents per feeder_2] )
VAR _3feeder =
CALCULATE (
MAX ( 'Years Since Last Exposure'[No. of Incidents per feeder_2] ),
FILTER (
ALLSELECTED ( 'Years Since Last Exposure' ),
'Years Since Last Exposure'[Years Since Last Trim] = 3
)
)
RETURN
DIVIDE ( _curfeeder, _3feeder ) - 1
It seems you have already resolve it by yourself, the above one is for reference only. Could you please mark this thread as Answered? Thank you.
Best Regards
Rena
Never mind, I figured out. I thought it was going to be more complicated than using calculate().
#_Pct change since Yr 3 =
DIVIDE(
[No. of Incidents per feeder_2],
CALCULATE([No. of Incidents per feeder_2], 'Years Since Last Exposure'[Years Since Last Trim] = 3)
) - 1
Hi @ashamsuzzoha ,
You can create a measure as below:
#_Pct change since Yr 3 =
VAR _curfeeder =
MAX ( 'Years Since Last Exposure'[No. of Incidents per feeder_2] )
VAR _3feeder =
CALCULATE (
MAX ( 'Years Since Last Exposure'[No. of Incidents per feeder_2] ),
FILTER (
ALLSELECTED ( 'Years Since Last Exposure' ),
'Years Since Last Exposure'[Years Since Last Trim] = 3
)
)
RETURN
DIVIDE ( _curfeeder, _3feeder ) - 1
It seems you have already resolve it by yourself, the above one is for reference only. Could you please mark this thread as Answered? Thank you.
Best Regards
Rena
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |