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 need to get previous row value (Result column) and need help. I tried DAX but its only giving me partial result.
The values should be previous rows taken from MyMeasure1.
My measure 1 is the DAX below, which is the cumulative calculated for Sales for each market and it is based on the Days column.
RunningSum=
CALCULATE(
SUM( 'TABLE'[sales] ),
FILTER(
ALLSELECTED('TABLE'),
TABLE'[Market_name]=MAX('TABLE'[market_name]) &&
'TABLE'[Days]>=MAX('TABLE'[Days])))
I appreciate any help.
Thanks.
Solved! Go to Solution.
Hi, @AnaStone_100
An optional option:
Step 1: Create an index column (you can add an index column through the UI in PowerQuery)
Step 2: Create the following measure
_getResult =
var _currentIndex=MAX('Table'[Index])
return
CALCULATE([My measure1 as Measure],FILTER(ALL('Table'),'Table'[Index]=_currentIndex-1))
////Assuming [My measure1 as Measure] is your measure1
Result:
Please refer to the attachment below for details. Hope this helps.
If this doesn't work for you, please consider sharing a sample.
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @AnaStone_100
An optional option:
Step 1: Create an index column (you can add an index column through the UI in PowerQuery)
Step 2: Create the following measure
_getResult =
var _currentIndex=MAX('Table'[Index])
return
CALCULATE([My measure1 as Measure],FILTER(ALL('Table'),'Table'[Index]=_currentIndex-1))
////Assuming [My measure1 as Measure] is your measure1
Result:
Please refer to the attachment below for details. Hope this helps.
If this doesn't work for you, please consider sharing a sample.
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@AnaStone_100 , Create a measure like this:
Prev Row Measure =
VAR res_ = CALCULATE([Running Sum Measure],FILTER(
ALLSELECTED('TABLE'),TABLE'[Market_name]=MAX('TABLE'[market_name]) &&'TABLE'[Days]>MAX('TABLE'[Days])))
RETURN IF(res_=BLANK(),[Running Sum Measure],res_)
I tried with some dummy data at my side:
Thanks for the help, but it didnt work.
I did the same DAX but the result I get is not correct, you get different result maybe beacuse you dont have addiitonal grouping in your data for the Days column.
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 |
---|---|
107 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
143 | |
104 | |
104 | |
80 | |
66 |