The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
97 | |
80 | |
62 | |
57 |
User | Count |
---|---|
264 | |
120 | |
115 | |
83 | |
70 |