Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
IF
Post Prodigy
Post Prodigy

Recent file and not showing the repeated values

Hi,

 

I have such data:

KetIDStIDTypeIDTypeLevelYesNoDateRecentLevel
K1223a3221Yes7/14/20211
K1223a3221No6/14/20210
K1223a3333Yes7/14/20211
K1223a3333No6/14/20210
K1223a3333Yes7/14/20211
K1223a4442Yes6/11/20210
K1223a4442No7/11/20211
K1222a73a1Yes6/11/20211
K1222a73a1Yes7/11/20211
K1222a63a2Yes3/11/20211
K1222a63a2Yes5/11/20211
K1323a3221No7/14/20211
K1323a3221No6/14/20211
K1323a3333Yes7/14/20210
K1323a3333No6/14/20211
K1323a3333NA7/14/20212
K1323a4442No3/11/20210
K1323a4442Yes7/11/20211
K1322a73a1Yes6/11/20211
K1322a73a1Yes7/11/20211
K1322a63a2No3/11/20210
K1322a63a2Yes5/11/20211

 

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:

KetIDStIDTypeIDTypeLevelYesNoDateRecentLevel
K1223a3221Yes7/14/20211
K1223a3333Yes7/14/20211
K1223a4442No7/11/20211
K1222a73a1Yes7/11/20211
K1222a63a2Yes5/11/20211

 

If I select K13, the result should be:

KetIDStIDTypeIDTypeLevelYesNoDateRecentLevel
K1323a3221No7/14/20211
K1323a3333NA7/14/20212
K1323a4442Yes7/11/20211
K1322a73a1Yes7/11/20211
K1322a63a2Yes5/11/20211

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

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 )

1.png

 

 

 

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.

View solution in original post

1 REPLY 1
v-stephen-msft
Community Support
Community Support

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 )

1.png

 

 

 

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.