Forum Discussion

itsmeanuj's avatar
itsmeanuj
Helper IV
3 years ago
Solved

Choose first instance based on the condition

Hi, so my data contains ~ 1M rows with more attribute columns than what i have included in the sample data. The Dummy PBIX file is placed here :  https://drive.google.com/file/d/1Yt1m0BUM483OQdsh-_a...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi itsmeanuj ,

    I updated your sample pbix file(see the attachment), please check if that is what you want.

    1. Create a measure as below

    Count of IDs = 
    VAR _latestdate =
        CALCULATE ( MAX ( 'Data'[STAMP] ), ALLSELECTED ( 'Data' ) )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'Data'[ID] ),
            FILTER (
                ALLSELECTED ( 'Data' ),
                'Data'[HAS_SHIPMENTS] = SELECTEDVALUE ( 'Data'[HAS_SHIPMENTS] )
                    && 'Data'[STAMP] = _latestdate
            )
        )

    2. Create a pie chart and table visual

    Best Regards