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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Get total of category without showing category

Hi everyone,

 

I am stuck with a measure that should display the total of IDs for each category, but without showing the category.

Currently, I am able to display the column "Total ID by Country" using the following measure:

 

 

 

 

 

Total ID by Country = 
CALCULATE(
    COUNT(Mentions[ID]),
    ALLEXCEPT(
        Mentions,
        Market[Country]  // Dimension table
    )
)

 

 

 

 

 

IDCountryCount IDTotal ID by Country
1US13
2US13
3US13
4FR17
5FR17
6FR17
7FR17
8FR17
9FR17
10FR17

 

The problem is, as long as I remove the "Country" column, I get this result (column country should not be displayed):

IDCountryCount IDTotal ID by Country
1US110
2US110
3US110
4FR110
5FR110
6FR110
7FR110
8FR110
9FR110
10FR110

 

The goal is to get this (Country column should not be displayed):

IDCount IDTotal ID by Country
113
213
313
417
517
617
717
817
917
1017

 

I don't think I can use a calculated column as this measure is sliced by other dimensions then.

 

Many thanks in advance for your help.

 

1 ACCEPTED SOLUTION

It will be either this or something close to it (depending on which fields make up the table)

Total ID by Country = 
CALCULATE(
    COUNT(Mentions[ID]),
    FILTER(ALL(Mentions),
            Mentions[Country] = MAX(Mentions[Country] ) 
    )
)

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , I doubt that will work without a country in context. But try this

Total ID by Country = 
CALCULATE(
    COUNT(Mentions[ID]),
    filter(
        allselected(Mentions),
        Market[Country]  =max(Market[Country] ) // Dimension table
    )
)
Anonymous
Not applicable

@amitchandakThanks for your answer.

 

Unfortunately, it does not solve my problem.

It will be either this or something close to it (depending on which fields make up the table)

Total ID by Country = 
CALCULATE(
    COUNT(Mentions[ID]),
    FILTER(ALL(Mentions),
            Mentions[Country] = MAX(Mentions[Country] ) 
    )
)
Anonymous
Not applicable

@HotChilli many thanks, it works!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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