Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hey,
I've looked through the forum examples and not sure if this is possible as everyone resorts to using a Table with columns but this means some of my data granularity is excluded e.g. Categories / Sub-Categories. I essentially need a measure that uses row context and filter context to find the difference between values and put this in a Matrix. This is by taking the latest period values and subtracting the next latest period values (period before MAX period).
sample PBI attached and photo of results:
https://drive.google.com/file/d/19KDNuA7CRElc-O1H8WwschGNoU29qUBv/view?usp=sharing
Solved! Go to Solution.
You can create a measure like
Diff =
VAR LatestPeriod =
CALCULATE(
MAX( 'Period Ref'[Period Ref] ),
ALLSELECTED( 'Period Ref' )
)
VAR CurrentPeriod = MAX( 'Period Ref'[Period Ref])
VAR PrevPeriod =
CALCULATE(
MAX( 'Period Ref'[Period Ref] ),
ALLSELECTED( 'Period Ref' ),
'Period Ref'[Period Ref] < LatestPeriod
)
VAR LatestValue =
CALCULATE(
[Total Value],
REMOVEFILTERS( 'Period Ref' ),
'Period Ref'[Period Ref] = LatestPeriod
)
VAR PrevValue =
CALCULATE(
[Total Value],
REMOVEFILTERS( 'Period Ref' ),
'Period Ref'[Period Ref] = PrevPeriod
)
RETURN
IF(
CurrentPeriod = LatestPeriod,
LatestValue - PrevValue
)
and add that to the values of the matrix
You can create a measure like
Diff =
VAR LatestPeriod =
CALCULATE(
MAX( 'Period Ref'[Period Ref] ),
ALLSELECTED( 'Period Ref' )
)
VAR CurrentPeriod = MAX( 'Period Ref'[Period Ref])
VAR PrevPeriod =
CALCULATE(
MAX( 'Period Ref'[Period Ref] ),
ALLSELECTED( 'Period Ref' ),
'Period Ref'[Period Ref] < LatestPeriod
)
VAR LatestValue =
CALCULATE(
[Total Value],
REMOVEFILTERS( 'Period Ref' ),
'Period Ref'[Period Ref] = LatestPeriod
)
VAR PrevValue =
CALCULATE(
[Total Value],
REMOVEFILTERS( 'Period Ref' ),
'Period Ref'[Period Ref] = PrevPeriod
)
RETURN
IF(
CurrentPeriod = LatestPeriod,
LatestValue - PrevValue
)
and add that to the values of the matrix
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 |
---|---|
80 | |
76 | |
60 | |
36 | |
33 |
User | Count |
---|---|
91 | |
60 | |
59 | |
49 | |
45 |