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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

calculating measure

Hi ,

i am new to power bi. please help me

 

I want to write a mearsure  like below

 

Count(a)>1 and aa='XYZ' then 1

Count(a)=1 and aa='ABC' then 2

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

Try like

measure2 = if([meausre1]>0,if(firstnonblank(table[aa],blank())="XYZ",1,if(firstnonblank(table[aa],blank())="ABC",2,0)),0)

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

Hi,

 

I create a sample to test:

5.PNG

Please try this measure:

 

Measure = DISTINCTCOUNT('Table'[CustomerID])

 

Choose [Gender] and [type] and this measure as a table visual, it shows:

6.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Try like

measure2 = if([meausre1]>0,if(firstnonblank(table[aa],blank())="XYZ",1,if(firstnonblank(table[aa],blank())="ABC",2,0)),0)

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
Anonymous
Not applicable

I need to count(distinct custid's) based on type, gender , how write formula for that

Hi,

 

I create a sample to test:

5.PNG

Please try this measure:

 

Measure = DISTINCTCOUNT('Table'[CustomerID])

 

Choose [Gender] and [type] and this measure as a table visual, it shows:

6.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

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.