Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello 🙂
I'm trying to track employee changes between 2 dates. I build measures to do this, and it works fine. but they are not dynamic with any slicers I want to add. Here is an example. I guess I'm just doing this wrong from the beginning, but I don't know how to handle this case.
ID | Name | Date | Categorie | Region |
1 | Adam Lister | 2020-01 | Professional | South |
1 | Adam Lister | 2020-02 | IT | South |
1 | Adam Lister | 2020-03 | IT | South |
2 | Suzie White | 2020-03 | IT | North |
2 | Suzie White | 2020-04 | IT | North |
2 | Suzie White | 2020-05 | Professional | South |
3 | Mike Right | 2020-01 | Professional | South |
3 | Mike Right | 2020-03 | IT | North |
3 | Mike Right | 2020-04 | IT | North |
3 | Mike Right | 2020-05 | Professional | North |
Solved! Go to Solution.
Hi @ArmellA ,
Please refer to my pbix file to see if it helps you.
Create a table included the category column.
Create a measure.
Measure =
VAR _mindate =
MINX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
'Table'[Date]
)
VAR _1 =
MINX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] = _mindate ), 'Table'[Region] )
VAR _maxdate =
MAXX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
'Table'[Date]
)
VAR _2 =
MINX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = _maxdate
&& 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] )
),
'Table'[Region]
)
VAR _re =
IF ( _1 = "South" && _2 = "North", 1, 0 )
RETURN
IF (
_re = 1
&& MAX ( 'Table'[Categorie] ) = SELECTEDVALUE ( 'Table (2)'[category] ),
1,
0
)
Then filter the measure is 1.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @ArmellA
Please refer to attached sample file with the solution
From North to South =
SUMX (
VALUES ( Employee[ID] ),
VAR CurrentEmpTable = CALCULATETABLE ( Employee )
VAR FirstRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], ASC ), Employee[Region] )
VAR LastRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], DESC ), Employee[Region] )
RETURN
IF ( FirstRegion = "North" && LastRegion= "South", 1 )
)
From South to North =
SUMX (
VALUES ( Employee[ID] ),
VAR CurrentEmpTable = CALCULATETABLE ( Employee )
VAR FirstRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], ASC ), Employee[Region] )
VAR LastRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], DESC ), Employee[Region] )
RETURN
IF ( FirstRegion = "South" && LastRegion= "North", 1 )
)
Hi @ArmellA
Please refer to attached sample file with the solution
From North to South =
SUMX (
VALUES ( Employee[ID] ),
VAR CurrentEmpTable = CALCULATETABLE ( Employee )
VAR FirstRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], ASC ), Employee[Region] )
VAR LastRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], DESC ), Employee[Region] )
RETURN
IF ( FirstRegion = "North" && LastRegion= "South", 1 )
)
From South to North =
SUMX (
VALUES ( Employee[ID] ),
VAR CurrentEmpTable = CALCULATETABLE ( Employee )
VAR FirstRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], ASC ), Employee[Region] )
VAR LastRegion = MAXX ( TOPN ( 1, CurrentEmpTable, Employee[Date], DESC ), Employee[Region] )
RETURN
IF ( FirstRegion = "South" && LastRegion= "North", 1 )
)
Hi @ArmellA ,
Please refer to my pbix file to see if it helps you.
Create a table included the category column.
Create a measure.
Measure =
VAR _mindate =
MINX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
'Table'[Date]
)
VAR _1 =
MINX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] = _mindate ), 'Table'[Region] )
VAR _maxdate =
MAXX (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
'Table'[Date]
)
VAR _2 =
MINX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] = _maxdate
&& 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] )
),
'Table'[Region]
)
VAR _re =
IF ( _1 = "South" && _2 = "North", 1, 0 )
RETURN
IF (
_re = 1
&& MAX ( 'Table'[Categorie] ) = SELECTEDVALUE ( 'Table (2)'[category] ),
1,
0
)
Then filter the measure is 1.
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
19 | |
7 | |
6 | |
5 | |
4 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |