Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi,
I am very new to Power BI and have a requirement that i cant quite get my head round. DS is a sharepoint list. I have a series of data grouped by period (these are bespoke periods so dates can't be used). Data looks like this:-
Period Parent Group Subgroup Area Rag status
10 Parent 1 Sub1 A1 Green
10 Parent 1 Sub1 A2 Red
10 Parent 1 Sub2 A3 Amber
10 Parent 2 Sub3 A4 Amber
9 Parent 1 Sub1 A1 Green
9 Parent 1 Sub1 A2 Amber
9 Parent 1 Sub2 A3 Green
9 Parent 2 Sub3 A4 Red
so what i want to do is assuming the current period is 10 then i want to compare the rag status for a given Area (areas can only belong to 1 sub and 1 parent and same for subs) from the current period against the Rag Status from the pervious period and determine if it has improved degraded or satyed the same.
Any help would be greatly appreciated.
Solved! Go to Solution.
Hi @Embers ,
If you want to create a Column, try this:
Previous Period Rag Status =
CALCULATE (
MAX ( 'Table'[Rag status] ),
FILTER (
'Table',
'Table'[Period]
= EARLIER ( 'Table'[Period] ) - 1
&& 'Table'[Parent Group] = EARLIER ( 'Table'[Parent Group] )
&& 'Table'[Subgroup] = EARLIER ( 'Table'[Subgroup] )
&& 'Table'[Area] = EARLIER ( 'Table'[Area] )
)
)
If you want to create a Measure, try this:
Previous Period Rag Status Measure =
CALCULATE (
MAX ( 'Table'[Rag status] ),
FILTER (
ALLSELECTED('Table'),
'Table'[Period]
= MAX ( 'Table'[Period] ) - 1
&& 'Table'[Parent Group] = MAX ( 'Table'[Parent Group] )
&& 'Table'[Subgroup] = MAX ( 'Table'[Subgroup] )
&& 'Table'[Area] = MAX ( 'Table'[Area] )
)
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Embers
Try this, but you probably want to include the year in your period, sol like 20191, 20192....
Column =
VAR __period = 'Table'[Period]
VAR __test =
CALCULATETABLE(
SUMMARIZE( 'Table', 'Table'[Period], 'Table'[Rag Status] ),
ALLEXCEPT( 'Table', 'Table'[Area ] ),
'Table'[Period] < __period
)
RETURN
CALCULATE(
SELECTEDVALUE( 'Table'[Rag Status] ),
TOPN( 1, __test, 'Table'[Period], DESC )
)
I can see what is going on there and what you are trying to do but it doesn't quite work. I just get blanks rather than the data i am looking foris the TOPN at the end meant to be the alt for the SELECTEDVALUE ?
Hi @Embers ,
If you want to create a Column, try this:
Previous Period Rag Status =
CALCULATE (
MAX ( 'Table'[Rag status] ),
FILTER (
'Table',
'Table'[Period]
= EARLIER ( 'Table'[Period] ) - 1
&& 'Table'[Parent Group] = EARLIER ( 'Table'[Parent Group] )
&& 'Table'[Subgroup] = EARLIER ( 'Table'[Subgroup] )
&& 'Table'[Area] = EARLIER ( 'Table'[Area] )
)
)
If you want to create a Measure, try this:
Previous Period Rag Status Measure =
CALCULATE (
MAX ( 'Table'[Rag status] ),
FILTER (
ALLSELECTED('Table'),
'Table'[Period]
= MAX ( 'Table'[Period] ) - 1
&& 'Table'[Parent Group] = MAX ( 'Table'[Parent Group] )
&& 'Table'[Subgroup] = MAX ( 'Table'[Subgroup] )
&& 'Table'[Area] = MAX ( 'Table'[Area] )
)
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I am reading this correctly, you want a calculated column and use EARLIER. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...
You can do like
This period = calculate(countrows(table),filter(all(table),table[period] =max(table[period]))
last period = calculate(countrows(table),filter(all(table),table[period] =max(table[period])-1)
But prefer creating a separate table for period and do
This period = calculate(countrows(table),filter(all(period),period[period] =max(table[period])-1)
last period = calculate(countrows(table),filter(all(period),period[period] =max(table[period])-1)
Not sure i follow. That just seems to give me the number of rows in a given period...
You can get like this
This period = calculate(max(status),filter(all(period),period[period] =max(table[period])-1)
last period = calculate(max(status),filter(all(period),period[period] =max(table[period])-1)
You can compare and get desired result
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 79 | |
| 38 | |
| 31 | |
| 27 | |
| 27 |