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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register 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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors