Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I have a table in fact that I have a calculation of a KPI, in the DAX view I need to return the result of the previous axis as shown in the image below from a dimension table.
Example, 2021 Q3 the KPI2 line returns the result of 2021 Q2
I used a form of rank to find the previous value with reference to rank -1, but I couldn't find any solution.
Solved! Go to Solution.
Hi, @Anonymous ;
You can use the Label_ period column directly, without the aid of rank. Please try it.
KPI 2 =
CALCULATE (
SUM ( [KPI] ),
FILTER (
ALL ( 'Table' ),
[label_ period]
= MAXX (
FILTER ( ALL ( 'Table' ), [label_ period] < MAX ( 'Table'[label_ period] ) ),
[label_ period]
)
)
)
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
You can use the Label_ period column directly, without the aid of rank. Please try it.
KPI 2 =
CALCULATE (
SUM ( [KPI] ),
FILTER (
ALL ( 'Table' ),
[label_ period]
= MAXX (
FILTER ( ALL ( 'Table' ), [label_ period] < MAX ( 'Table'[label_ period] ) ),
[label_ period]
)
)
)
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , you need to create a dense rank on period label or order KPI and prefer that to be in separate column along with base column, joined to this table
example
new column
Qtr Rank = RANKX(all('Date'),'Date'[Qtr Start date],,ASC,Dense)
Measure
This Qtr = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])))
Last Qtr = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Qtr Rank]=max('Date'[Qtr Rank])-1))
The approach which we follow on week or custom months
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
13 | |
11 | |
8 |