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
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
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