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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
FarquharG
New Member

Need help with DAX code that includes only specific values

Hi everyone.

 

I have a dashboard that includes a bar chart and line chart that compares data from one organization versus the total of all the  organizations in the region. I need the regional data to not be affected by any other filters with one exception - specfic values in the classification column.

 

Here is my DAX code:

Regional Measure =

    CALCULATE(
        SUM('AllData'[TotalInquiries]),
        ALL('AllData'[Organization]),
        'AllData'[Classification] IN {"Class II", "Class III", "Class IV"}
    )
 
When I use this code, it includes all classifications instead of just the ones I listed above. How can I get this to work? 
8 REPLIES 8
v-nmadadi-msft
Community Support
Community Support

Hi @FarquharG 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Thanks and regards

v-nmadadi-msft
Community Support
Community Support

Hi @FarquharG ,

As we haven’t heard back from you, we wanted to kindly follow up to check the status of your issue, if it is still unresolved, Kindly share some sample data so that we can take a closer look and try to assist you further

Thanks and regards

 

Poojara_D12
Super User
Super User

Hi @FarquharG 

Regional Measure = 
CALCULATE(
    SUM('AllData'[TotalInquiries]),
    ALL('AllData'[Organization]),
    FILTER(
        ALL('AllData'[Classification]),
        'AllData'[Classification] IN {"Class II", "Class III", "Class IV"}
    )
)

This version removes filters on Organization but only allows Class II, III, and IV to pass through in the Classification column. It ensures that your regional measure stays unaffected by organization-level filters but still respects specific classifications—exactly as intended in your use case.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
v-nmadadi-msft
Community Support
Community Support

Hi @FarquharG ,
May I check if this issue has been resolved? If not, could you please share some sample data so we can investigate further and provide more targeted assistance.
Thank you

v-nmadadi-msft
Community Support
Community Support

Hi @FarquharG ,

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

Please show the expected outcome based on the sample data you provided.
Thank you

FBergamaschi
Helper V
Helper V

Can you please paste here some example of the table so we can reproduce the error? So we can import in Power BI and help you

Greg_Deckler
Super User
Super User

@FarquharG Try this:

Regional Measure =
  VAR __Table = FILTER( ALL( 'AllData' ), [Classification] IN {"Class II", "Class III", "Class IV" )
  VAR __Result = SUMX( __Table, [TotalInquiries] )
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

 

I added a "}" at the end of the first VAR line after "Class IV" because it was giving me an error. When I attempted the code, my regional numbers disappeared from the visuals.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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