The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I would like to know what formula to use to get the percentage difference from the previous data that I have (seen from the image). Thank you!
Solved! Go to Solution.
Hi, @rkxiii
You can try the following methods.
Measure:
Diff =
Var _Prevdate=CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),[Date]<SELECTEDVALUE('Table'[Date])))
Var _PrevYield=CALCULATE([Yield],FILTER(ALL('Table'),[Date]=_Prevdate))
RETURN
IF(_PrevYield=BLANK(),BLANK(),[Yield]-_PrevYield)
Is this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @rkxiii
You can try the following methods.
Measure:
Diff =
Var _Prevdate=CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),[Date]<SELECTEDVALUE('Table'[Date])))
Var _PrevYield=CALCULATE([Yield],FILTER(ALL('Table'),[Date]=_Prevdate))
RETURN
IF(_PrevYield=BLANK(),BLANK(),[Yield]-_PrevYield)
Is this the result you expected?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Also could you please include the Model Name for this solution? Thank you very much for your help!
Its okay now. I just Filter All Except the Model Name. Thank you!
Hi, Thank you very much for your help. This is the solution I am looking for. Again, Thank you very much!
Hi @rkxiii, Hope you are doing good!
Please try the below DAX to create a new calculated column as per your requirement:
Difference =
VAR PreviousPercent =
CALCULATE(
MAX(TableName[Percent]),
FILTER(
TableName,
TableName[IndexColumn] = EARLIER(TableName[IndexColumn]) - 1
)
)
RETURN
IF(
ISBLANK(PreviousPercent),
0,
TableName[Percent] - PreviousPercent
)
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Hi, Thank you for your response.
I used the PowerBi Visual "Table" for the table used in the image, is the solution still applicable?
Is it also possible just to add "New Measure" for the percentage? Thank you.