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,
I have such data:
KetID | StID | TypeID | TypeLevel | YesNo | Date | RecentLevel |
K12 | 23 | a322 | 1 | Yes | 7/14/2021 | 1 |
K12 | 23 | a322 | 1 | No | 6/14/2021 | 0 |
K12 | 23 | a333 | 3 | Yes | 7/14/2021 | 1 |
K12 | 23 | a333 | 3 | No | 6/14/2021 | 0 |
K12 | 23 | a333 | 3 | Yes | 7/14/2021 | 1 |
K12 | 23 | a444 | 2 | Yes | 6/11/2021 | 0 |
K12 | 23 | a444 | 2 | No | 7/11/2021 | 1 |
K12 | 22 | a73a | 1 | Yes | 6/11/2021 | 1 |
K12 | 22 | a73a | 1 | Yes | 7/11/2021 | 1 |
K12 | 22 | a63a | 2 | Yes | 3/11/2021 | 1 |
K12 | 22 | a63a | 2 | Yes | 5/11/2021 | 1 |
K13 | 23 | a322 | 1 | No | 7/14/2021 | 1 |
K13 | 23 | a322 | 1 | No | 6/14/2021 | 1 |
K13 | 23 | a333 | 3 | Yes | 7/14/2021 | 0 |
K13 | 23 | a333 | 3 | No | 6/14/2021 | 1 |
K13 | 23 | a333 | 3 | NA | 7/14/2021 | 2 |
K13 | 23 | a444 | 2 | No | 3/11/2021 | 0 |
K13 | 23 | a444 | 2 | Yes | 7/11/2021 | 1 |
K13 | 22 | a73a | 1 | Yes | 6/11/2021 | 1 |
K13 | 22 | a73a | 1 | Yes | 7/11/2021 | 1 |
K13 | 22 | a63a | 2 | No | 3/11/2021 | 0 |
K13 | 22 | a63a | 2 | Yes | 5/11/2021 | 1 |
I use KetID as slicer.
I want to see the most recent TypeID by looking at the date. If there is a repeated value (which is always the same), I want to see only one of them.
If I select K12, the result should be:
KetID | StID | TypeID | TypeLevel | YesNo | Date | RecentLevel |
K12 | 23 | a322 | 1 | Yes | 7/14/2021 | 1 |
K12 | 23 | a333 | 3 | Yes | 7/14/2021 | 1 |
K12 | 23 | a444 | 2 | No | 7/11/2021 | 1 |
K12 | 22 | a73a | 1 | Yes | 7/11/2021 | 1 |
K12 | 22 | a63a | 2 | Yes | 5/11/2021 | 1 |
If I select K13, the result should be:
KetID | StID | TypeID | TypeLevel | YesNo | Date | RecentLevel |
K13 | 23 | a322 | 1 | No | 7/14/2021 | 1 |
K13 | 23 | a333 | 3 | NA | 7/14/2021 | 2 |
K13 | 23 | a444 | 2 | Yes | 7/11/2021 | 1 |
K13 | 22 | a73a | 1 | Yes | 7/11/2021 | 1 |
K13 | 22 | a63a | 2 | Yes | 5/11/2021 | 1 |
Thanks in advance!
Solved! Go to Solution.
Hi @IF ,
Create the following measure and put it into Filters, set show items when the value is 1.
Measure =
VAR _date =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table' ), [TypeID] = MAX ( 'Table'[TypeID] ) )
)
VAR _rank =
RANKX (
FILTER ( ALLSELECTED ( 'Table' ), [TypeID] = MAX ( 'Table'[TypeID] ) ),
CALCULATE ( SUM ( 'Table'[RecentLevel] ) ),
,
DESC,
DENSE
)
RETURN
IF ( _date = MAX ( 'Table'[Date] ) && _rank = 1, 1 )
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @IF ,
Create the following measure and put it into Filters, set show items when the value is 1.
Measure =
VAR _date =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table' ), [TypeID] = MAX ( 'Table'[TypeID] ) )
)
VAR _rank =
RANKX (
FILTER ( ALLSELECTED ( 'Table' ), [TypeID] = MAX ( 'Table'[TypeID] ) ),
CALCULATE ( SUM ( 'Table'[RecentLevel] ) ),
,
DESC,
DENSE
)
RETURN
IF ( _date = MAX ( 'Table'[Date] ) && _rank = 1, 1 )
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
97 | |
95 | |
76 | |
72 | |
65 |
User | Count |
---|---|
136 | |
109 | |
104 | |
82 | |
73 |