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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
awiefoong
Frequent Visitor

Help needed to calculate with DAX

Hi Power BI Community,

 

I have a raw data table as follow:

 

CountryRegionCat
AlbaniaAL1L
AlbaniaAL2M
AlbaniaAL3M
AlbaniaAL4M
AlbaniaAL5L
AlbaniaAL6L
BahrainBH1M
BahrainBH2M
BahrainBH3M
BahrainBH4L
DenmarkDN1M
DenmarkDN2L
DenmarkDN3M
KazakhstanKA1M
KazakhstanKA2L
KazakhstanKA3L
KazakhstanKA4L
KazakhstanKA5L
South AfricaSA1M
South AfricaSA2M
South AfricaSA3L
South AfricaSA4M
South AfricaSA5L
South AfricaSA6L
South AfricaSA7L

 

This is what I would like to do:

(1) To check if each Country has at least two "L" AND two "M". If Yes, then the countries are meeting the criteria and will be given a "Met" criteria. If No, then the countries will be given a "Unmet" criteria, as follow.

 

Intended Sumary-1 
CountryCriteria
AlbaniaMet
BahrainUnmet
DenmarkUnmet
KazakhstanUnmet
South AfricaMet

 

(2) From here, I would then like to count how many countries met the criteria. In this case, the answer should be 2 countries. From there, I would be able to calculate % of countries met, which is 2/6 = 33%. This is where I got stuck. Would appreciate your help greatly. Many thanks!

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@awiefoong , Create a new measure like

 

Criteria =
if( isblank(countx(filter(summarize(Table, Table[Country], "_1", calculate(countrows(Table[Country]), filter(Table, Table[Cat] ="L")), "_2", calculate(countrows(Table[Country]), filter(Table, Table[Cat] ="M"))), [_1] >=2 && [_2] >=2 ), [Country])), "Unmet","Met")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@awiefoong , Create a new measure like

 

Criteria =
if( isblank(countx(filter(summarize(Table, Table[Country], "_1", calculate(countrows(Table[Country]), filter(Table, Table[Cat] ="L")), "_2", calculate(countrows(Table[Country]), filter(Table, Table[Cat] ="M"))), [_1] >=2 && [_2] >=2 ), [Country])), "Unmet","Met")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

It works! Many thanks @amitchandak 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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