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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
JacobMich
Regular Visitor

How do I filter POWERBI data in my visual workspace based on values in two columns?

I am working in PowerBI.  I am looking for a specific filtering and counting of information from an already transformed query.  The raw data of what I am asking for can be seen in the Table Below.  I want to only count and show all "US" AND "5", as well as count and show all MX "4".  I want to leave out US "4" and leave out MX "5", in the count scenario.

CountryLevel

US

4
US5
US4
MX5
MX4
US5
1 ACCEPTED SOLUTION
Nayan_Dholakia
Frequent Visitor

Filtered Count =
CALCULATE(
COUNTROWS('YourTableName'),
FILTER(
'YourTableName',
('YourTableName'[Country] = "US" && 'YourTableName'[Level] = 5)
|| ('YourTableName'[Country] = "MX" && 'YourTableName'[Level] = 4)
)
)

Replace with Table Name as per yours

View solution in original post

6 REPLIES 6
v-saisrao-msft
Community Support
Community Support

Hi @JacobMich,

I hope you had a chance to review the solution shared by @danextian @ryan_mayu @Nayan_Dholakia . If it addressed your question, please consider accepting it as the solution — it helps others find answers more quickly.
If you're still facing the issue, feel free to reply, and we’ll be happy to assist further.

 

Thank you.

 

danextian
Super User
Super User

Hi @JacobMich 

I'm not sure what you expected results are but try these measures:

US and 5 = 
COUNTROWS ( FILTER ( 'Table', 'Table'[Country] = "US" && 'Table'[Level] = 5 ) )
MX and 4 = 
COUNTROWS ( FILTER ( 'Table', 'Table'[Country] = "MX" && 'Table'[Level] = 4 ) )
Both = 
COUNTROWS (
    FILTER (
        'Table',
        ( 'Table'[Country] = "US"
            && 'Table'[Level] = 5 )
            || ( 'Table'[Country] = "MX"
            && 'Table'[Level] = 4 )
    )
)

danextian_0-1751349780758.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
ryan_mayu
Super User
Super User

@JacobMich 

how do you want to display the output? in the card or in a table?

You can try @Nayan_Dholakia 's solution. That will work

 

if you want to display in a card, add the meausre to the card

11.png

 

if you want to display in a tabel, try to update the measure

measure 2 = if(max('Table'[Country])="US" &&max( 'Table'[Level])=5 || max('Table'[Country])="MX"&& max('Table'[Level])=4,1)
 
and add the measure to visual filter and set to 1
12.png
 
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Nayan_Dholakia
Frequent Visitor

Filtered Count =
CALCULATE(
COUNTROWS('YourTableName'),
FILTER(
'YourTableName',
('YourTableName'[Country] = "US" && 'YourTableName'[Level] = 5)
|| ('YourTableName'[Country] = "MX" && 'YourTableName'[Level] = 4)
)
)

Replace with Table Name as per yours

Where do I place the above code and syntax?

Create a Dax - New measure

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors