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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gitcen7
Frequent Visitor

Measure for counting that ignores only one filter context

The below is my data model.

gitcen7_1-1710137042516.png

 

'Competitor Count' in the below table is a measure. Formula: CALCULATE(DISTINCTCOUNT('Fact Table'[Competitor ID]),ALLSELECTED('Fact Table'[Competitor ID]))

gitcen7_2-1710137073512.png

The 'Competitor Count' column should be showing 9 instead of 1 for all rows in the table (since there are 9 competitors total for 'Variant ID' 10004). I've tried using ALLSELECTED on 'Competitor'[Competitor ID] also and that hasn't worked.

 

Clarification: The 'Competitor ID' column in the above visual is from the 'Competitors' dimension table, NOT the 'Fact Table'. The 'Variant ID' column in the above visual is from the 'Variants' dimension table, NOT the 'Fact Table'.

1 ACCEPTED SOLUTION
sjoerdvn
Super User
Super User

sjoerdvn_1-1710774587527.png

 

You need the "ALL" on the dimension, otherwise it will keep filtering the fact. Adding the "IF" to prevent returning rows for Competitor/Variant combinations that do not exist.

View solution in original post

7 REPLIES 7
sjoerdvn
Super User
Super User

sjoerdvn_1-1710774587527.png

 

You need the "ALL" on the dimension, otherwise it will keep filtering the fact. Adding the "IF" to prevent returning rows for Competitor/Variant combinations that do not exist.

This worked for me, thank you very much!

Walter_W2022
Resolver II
Resolver II

Hi @gitcen7 , I used your measure to count [Competitor ID] and got 9 for 10004, not sure why you got 1, could you please share your pbix file for further investigate? thanks.

Walter_W2022_0-1710138476984.png

 

Hi @Walter_W2022, to clarify, the Competitor ID column in the table is from the 'Competitors' data table, NOT the 'Fact Table'.

Hi @gitcen7  in this case, you only need to add REMOVEFILTERS, please see below
REMOVEFILTERS(DimCompetitorID[Competitor ID]

Walter_W2022_0-1710192716644.png

Walter_W2022_1-1710192815860.png

 

@Walter_W2022 - I've shared a pbix file since adding REMOVEFILTERS doesn't work either 

https://drive.google.com/file/d/12J5J1io3k-lvwgdf5X33AMGK-sFwol8l/view?usp=drive_link 

 

@Walter_W2022 - apologies for the delayed response. See the link for an example pbix file.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors