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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
sara_pinto15
Helper I
Helper I

Sum of Distinct Count of an ID

Hello.

Before explaining the problem, I will start with the objective: to know the number of IDs whose difference in the amount of Status is equal to 0.
My IDs can be associated with multiple Statuses, however, for a specific Status, if it is unique, I have a problem.
To find out which Ids had this problem I did a count of the total status, and later a count of a specific status. If the difference between the two counts for each of the IDs is zero, then that ID has to be parsed.
To know the total number of IDs I created the following measure:

sara_pinto15_0-1666610431387.png

But when I want to know the total on the card, the value appears "Blank".

sara_pinto15_1-1666610553735.png

If I select an Id in the visual, the count is done.

sara_pinto15_2-1666610629577.png


I cannot understand why. Can you help?

 

 

 

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

Hi @sara_pinto15 ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1666926742364.png

Please try:

Measure =
VAR _a =
    ADDCOLUMNS (
        'FAT_SAP_Mobile_Cargamentos',
        "Flag",
            IF (
                COUNTX (
                    FILTER (
                        'FAT_SAP_Mobile_Cargamentos',
                        [/BIC/ZIDMOBILE] = EARLIER ( FAT_SAP_Mobile_Cargamentos[/BIC/ZIDMOBILE] )
                    ),
                    [/BIC/ZIDMOBILE]
                )
                    - COUNTX (
                        FILTER (
                            'FAT_SAP_Mobile_Cargamentos',
                            [/BIC/ZIDMOBILE] = EARLIER ( FAT_SAP_Mobile_Cargamentos[/BIC/ZIDMOBILE] )
                                && [/BIC/ZSTATSD] = 8
                        ),
                        [/BIC/ZIDMOBILE]
                    ) = 0,
                "Yes",
                "No"
            )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( FAT_SAP_Mobile_Cargamentos[/BIC/ZIDMOBILE] ),
        FILTER ( _a, [Flag] = "Yes" )
    )

Final output:

vjianbolimsft_0-1666943277918.png

Best Regards,

Jianbo Li

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

4 REPLIES 4
v-jianboli-msft
Community Support
Community Support

Hi @sara_pinto15 ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1666926742364.png

Please try:

Measure =
VAR _a =
    ADDCOLUMNS (
        'FAT_SAP_Mobile_Cargamentos',
        "Flag",
            IF (
                COUNTX (
                    FILTER (
                        'FAT_SAP_Mobile_Cargamentos',
                        [/BIC/ZIDMOBILE] = EARLIER ( FAT_SAP_Mobile_Cargamentos[/BIC/ZIDMOBILE] )
                    ),
                    [/BIC/ZIDMOBILE]
                )
                    - COUNTX (
                        FILTER (
                            'FAT_SAP_Mobile_Cargamentos',
                            [/BIC/ZIDMOBILE] = EARLIER ( FAT_SAP_Mobile_Cargamentos[/BIC/ZIDMOBILE] )
                                && [/BIC/ZSTATSD] = 8
                        ),
                        [/BIC/ZIDMOBILE]
                    ) = 0,
                "Yes",
                "No"
            )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( FAT_SAP_Mobile_Cargamentos[/BIC/ZIDMOBILE] ),
        FILTER ( _a, [Flag] = "Yes" )
    )

Final output:

vjianbolimsft_0-1666943277918.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-jianboli-msft
Community Support
Community Support

Hi @sara_pinto15 ,

 

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, @v-jianboli-msft 

 

So, I have a table like this:

sara_pinto15_0-1666708290438.png

 

If I have a /BIC/ZIDMOBIE with only status 8, like below I have a problem.

 

sara_pinto15_1-1666708717815.png

 

So, my goal is to know the quantity of cases that only have status 8, and put that value on a card.

 

Did this help clarify my problem a bit more?

 

 

 

Thank you very much, this solved my problem. 😊

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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