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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
CMajka8
Helper I
Helper I

DAX Help - Excluding Some Filters on the Page

Hello Community - 

 

TLDR; I am looking for a DAX measure that will calculate the total distinct count of companies in a column, while ignoring certain slicers on the page.

 

I am creating a dynamic text title that says something like "Company X ranks 13 out of 331 companies in Premium Written during the year." I am looking for a DAX formula that can help me count the total number of companies (331) for the year selected. The page has a Year slicer and a Company Name slicer. Therefore, the measure would need to ignore the Company Name slicer, but evaluate the Year selected. 

So far, I have this, but it gives me the total count for all years, regardless of the Year selected:

Loss Line Chart Title =
IF (
ISFILTERED('Company DIM'[Company Name]),
CONCATENATEX ( VALUES ('Company DIM'[Company Name] ), 'Company DIM'[Company Name], ", " ) & " ranks " & [RANK Loss Ratio] & " out of " & [PC Counts] & " in Loss Ratio",
"All selected companies"
)
 
The measure for the counts is this:
PC Counts = CALCULATE( DISTINCTCOUNT('Data FACT'[PC]), ALLEXCEPT( 'Data FACT', 'Data FACT'[PC] ))
 
Thanks!
Chris
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@CMajka8 , use all, allselected, removefilters

 

PC Counts = CALCULATE( DISTINCTCOUNT('Data FACT'[PC]), all( 'Data FACT'))

 

or

PC Counts = CALCULATE( DISTINCTCOUNT('Data FACT'[PC]), allselecetd( 'Data FACT'))

 

https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
CMajka8
Helper I
Helper I

I think I've solved it - thanks for you help. 

PC Counts = CALCULATE( COUNT('Data FACT'[PC]), ALL( 'Company DIM'[Company Name]))
 
This gets me the correct total count based on the year selected and doesn't consider the Company Name slicer. 
amitchandak
Super User
Super User

@CMajka8 , use all, allselected, removefilters

 

PC Counts = CALCULATE( DISTINCTCOUNT('Data FACT'[PC]), all( 'Data FACT'))

 

or

PC Counts = CALCULATE( DISTINCTCOUNT('Data FACT'[PC]), allselecetd( 'Data FACT'))

 

https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you. However, that appears to only give me a count of 1, based on the selction made in the Company Name slicer. I want to ignore that selection and get a total count of companies.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Users online (2,318)