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.
Hi there,
I have a table like that:
Market_Week | Sum Quantity |
2 | 705 |
3 | 8272 |
4 | 8285 |
6 | 8705 |
7 | 8717 |
8 | 8726 |
10 | 9211 |
12 | 40157 |
13 | 43308 |
15 | 47564 |
16 | 49146 |
And i want to get previous values like:
Market_Week | Sum Quantity | Previous Sum Quantity |
2 | 705 | |
3 | 8272 | 705 |
4 | 8285 | 8272 |
6 | 8705 | 8285 |
7 | 8717 | 8705 |
8 | 8726 | 8717 |
10 | 9211 | 8726 |
12 | 40157 | 9211 |
13 | 43308 | 40157 |
15 | 47564 | 43308 |
16 | 49146 | 47564 |
How can I handle this?
Thank you and I look forward to your support.
Solved! Go to Solution.
Hi @NQT1711
I am sure there are many ways to do this, but one way is to create a calculated column for the indexing by rankx, and then to create another calculated column bringing the previous row.
Best regards,
Hi @NQT1711 ,
Creating calculated columns is indeed a good option, as @DataNinja777 provides.
However, if your data model is too large, it may increase the memory burden since the calculated columns will actually be added to the data model.
Perhaps create a measure is a good option, refer to the following formula:
MEASURE =
MAXX (
FILTER ( ALL ( 'Table' ), 'Table'[Market_Week] < MAX ( 'Table'[Market_Week] ) ),
[Sum Quantity]
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NQT1711 ,
Creating calculated columns is indeed a good option, as @DataNinja777 provides.
However, if your data model is too large, it may increase the memory burden since the calculated columns will actually be added to the data model.
Perhaps create a measure is a good option, refer to the following formula:
MEASURE =
MAXX (
FILTER ( ALL ( 'Table' ), 'Table'[Market_Week] < MAX ( 'Table'[Market_Week] ) ),
[Sum Quantity]
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NQT1711
I am sure there are many ways to do this, but one way is to create a calculated column for the indexing by rankx, and then to create another calculated column bringing the previous row.
Best regards,
There's two way that you can do it now.
1. Create a Measure
var _selecteddate= FIRSTDATE('Calendar'[week])-1
var PreviousDayTotal=CALCULATE(SUM(QUANTITTY),TREATAS({_selecteddate},'Calendar'[week]))
RETURN
IF(SUM(QUANTITTY)=BLANK(),BLANK(), SUM(QUANTITTY))
2. New features
You can calculate the previous value using new calculation as well which is the prefered solution now.
Visual calculations (preview) | Microsoft Power BI Blog | Microsoft Power BI
Kaviraj11,
I strongly disagree that visual calculations are the preferred solution.
They're still a preview feature. They are also specific to the visual only and cannot be reused anywhere else.
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 | |
102 | |
86 | |
77 | |
68 |
User | Count |
---|---|
120 | |
108 | |
98 | |
83 | |
77 |