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.
Hello,
I want to see the year over year change in the $/Kg calculation
I have the measure [k/g]= sum(table1;[$])/sum(Table1;[kg])
my data base looks like the first picture, and I want to see the measure like the second table in power bi
Please someone help me
Solved! Go to Solution.
Hi @Anonymous,
You can try to use below measure if it works for your scenario:
YOY $/Kg = VAR currYear = YEAR ( MAX ( Table1[Date] ) ) VAR currSKG = CALCULATE ( SUM ( table1[$] ) / SUM ( Table1[kg] ), FILTER ( ALLSELECTED ( Table1 ), YEAR ( Table1[Date] ) = currYear ), VALUES ( Table1[Item] ) ) VAR prevSKG = CALCULATE ( SUM ( table1[$] ) / SUM ( Table1[kg] ), FILTER ( ALLSELECTED ( Table1 ), YEAR ( Table1[Date] ) = currYear - 1 ), VALUES ( Table1[Item] ) ) RETURN IF ( prevSKG <> BLANK (), DIVIDE ( currSKG - prevSKG, prevSKG, -1 ), 1 )
Regards,
Xiaoxin Sheng
Hi @Anonymous,
You can try to use below measure if it works for your scenario:
YOY $/Kg = VAR currYear = YEAR ( MAX ( Table1[Date] ) ) VAR currSKG = CALCULATE ( SUM ( table1[$] ) / SUM ( Table1[kg] ), FILTER ( ALLSELECTED ( Table1 ), YEAR ( Table1[Date] ) = currYear ), VALUES ( Table1[Item] ) ) VAR prevSKG = CALCULATE ( SUM ( table1[$] ) / SUM ( Table1[kg] ), FILTER ( ALLSELECTED ( Table1 ), YEAR ( Table1[Date] ) = currYear - 1 ), VALUES ( Table1[Item] ) ) RETURN IF ( prevSKG <> BLANK (), DIVIDE ( currSKG - prevSKG, prevSKG, -1 ), 1 )
Regards,
Xiaoxin Sheng
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 |
---|---|
110 | |
99 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |