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
olimilo
Responsive Resident
Responsive Resident

ALLEXCEPT ignores row context, showing the total for the entire dataset?

I have the following datasets related 1:M via the ID field. When I use the measure below to get the totals in a matrix, the All Clients measure gets the total for the entire dataset, including the countries not shown in the matrix. How can I modify the All Clients measure to just show the totals for the displayed countries?

 

~Selected Client = 
    CALCULATE(
        COUNTROWS('Findings')
    )

 

 

 

~All Clients = 
    CALCULATE(
        COUNTROWS('Findings'),
        ALLEXCEPT(
            'Data',
            'Calendar',
            'Data'[Country],
            'Data'[Type],
            'Data'[Service],
            'Data'[Profile]
        )
    )

 

 

olimilo_0-1677137625455.png

Selected Client shows the correct row count; All Clients shows the correct total for each country, but the total shows the total row count for the entire dataset - including the countries not displayed.

 

Data

IDClientNameCountryTypeServiceProfile
644164ClientChinaInitialSOCClient Standard
617872ClientIndonesiaInitialSOCClient Standard
623246GlobalJapanInitialSOCClient Standard
585442GlobalChinaInitialSOCClient Standard
582886ClientChinaInitialSOCClient Standard
582769ClientSouth KoreaInitialSOCClient Standard

 

Finding

IDFinding
644164Finding 2
644164Finding 3
644164Finding 4
617872Finding 5
617872Finding 6
623246Finding 7
623246Finding 8
623246Finding 9
585442Finding 10
585442Finding 11
582886Finding 12
582769Finding 13
582769Finding 14

 

Essentially, the output using the sample data (if I filtered the page with the field Client = "Client"):

CountrySelected ClientAll Clients
China21
Indonesia1 
South Korea1 
1 REPLY 1
v-xinruzhu-msft
Community Support
Community Support

Hi @olimilo 

You can create a new measure

Total_AllClients = SUMX(VALUES(Data[Country]),[~All Clients])

vxinruzhumsft_1-1677466454480.png

Best Regards!

Yolo Zhu

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.