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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
AmiraBedh
Super User
Super User

Count measure except for the selected value in the slicer

I have the following Fact RAF is 1 to 1 whith Main Hubs table
and Fact Raf is Many to Many with Secondary Hubs
and Fact Raf is Many to 1 with Dim Date

and the Image in the table Fact Raf which is the date of the load data

my measure logic is like below :

I want when for example I select Dubai and Paris from the Main Hubs
it gives for the image 10102024 the count of RAF Id from Fact RAF 50

then in the background without any selection, from the Secondary Hubs I consider all the values except for Dubai and Paris for the same image 10102024 it gives 25

the measure will show 50 + 25 = 75


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
1 ACCEPTED SOLUTION
Bibiano_Geraldo
Super User
Super User

Hi @AmiraBedh ,

If i understood well, to achieve this you can create a measure that calculates the count of RAF Id based on your selection from the Main Hubs and then adds the count from the Secondary Hubs excluding the selected values by using bellow DAX:

 

Create a measure for the count of RAF Id based on the Main Hubs selection:

SelectedMainHubsCount = 
CALCULATE(
    COUNT('Fact RAF'[RAF Id]),
    'Main Hubs'[Hub] IN {"Dubai", "Paris"},
    'Fact RAF'[Image] = "10102024"
)

 

 Now create a measure for the count of RAF Id from Secondary Hubs excluding the selected Main Hubs

ExcludedSecondaryHubsCount = 
CALCULATE(
    COUNT('Fact RAF'[RAF Id]),
    NOT 'Secondary Hubs'[Hub] IN {"Dubai", "Paris"},
    'Fact RAF'[Image] = "10102024"
)

 

And finally you can combine these measures to get the total count by this DAX:

TotalRAFCount = 
[SelectedMainHubsCount] + [ExcludedSecondaryHubsCount]

 

Feel free to adjust the measure names and logic as per your specific data model and requirements.

If this repply help you, please consider to accept as solution and give a Kudo.

 

Thank you

View solution in original post

2 REPLIES 2
Bibiano_Geraldo
Super User
Super User

Hi @AmiraBedh ,

If i understood well, to achieve this you can create a measure that calculates the count of RAF Id based on your selection from the Main Hubs and then adds the count from the Secondary Hubs excluding the selected values by using bellow DAX:

 

Create a measure for the count of RAF Id based on the Main Hubs selection:

SelectedMainHubsCount = 
CALCULATE(
    COUNT('Fact RAF'[RAF Id]),
    'Main Hubs'[Hub] IN {"Dubai", "Paris"},
    'Fact RAF'[Image] = "10102024"
)

 

 Now create a measure for the count of RAF Id from Secondary Hubs excluding the selected Main Hubs

ExcludedSecondaryHubsCount = 
CALCULATE(
    COUNT('Fact RAF'[RAF Id]),
    NOT 'Secondary Hubs'[Hub] IN {"Dubai", "Paris"},
    'Fact RAF'[Image] = "10102024"
)

 

And finally you can combine these measures to get the total count by this DAX:

TotalRAFCount = 
[SelectedMainHubsCount] + [ExcludedSecondaryHubsCount]

 

Feel free to adjust the measure names and logic as per your specific data model and requirements.

If this repply help you, please consider to accept as solution and give a Kudo.

 

Thank you

Anonymous
Not applicable

Hi @AmiraBedh ,

There are too many tables involved in your question. I can't guess and create sample data to solve your problem. Please provide sample data for all tables and provide some of your expected results based on these sample data. Thank you!

Best Regards,
Dino Tao

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors