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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
thomasreick
Resolver I
Resolver I

Creating a measure based on one physical columns and one measure???

Hi all,

please recommend on the following...

I need to calculate a measure out of two columns within the same table.

One is a physical column, one is result of count-aggregation.

One column should be COUNT(Index)), the other is a disjunctive condition set by PowerQuery in field [tmp].

Values for [tmp] are either 5 or 0.

 

I do not get the point on how to set IF-Statement....

 

IF (AND([tmp]=5), COUNT([Index])>=5,5,

IF (AND([tmp]=0), COUNT([Index])>=5,4,

IF (AND([tmp]=0), COUNT([Index])=4,3,

IF (AND([tmp]=0), COUNT([Index])=3,2,

IF (AND([tmp]=0), COUNT([Index])=2,2,

IF (AND([tmp]=0), COUNT([Index])=1,1,0))))

 

All hints welcome.

 

thx&brgds

Thomas

 

1 ACCEPTED SOLUTION
jppv20
Solution Sage
Solution Sage

Hi @thomasreick ,

 

Try this measure:

Measure =
IF(AND(MAX('Table'[TMP])=5,COUNT([Index])>=5),5,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])>=5),4,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=4),3,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=3),2,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=2),2,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=1),1,0))))))
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
jppv20
Solution Sage
Solution Sage

Hi @thomasreick ,

 

Try this measure:

Measure =
IF(AND(MAX('Table'[TMP])=5,COUNT([Index])>=5),5,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])>=5),4,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=4),3,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=3),2,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=2),2,
IF (AND(MAX('Table'[TMP])=0, COUNT([Index])=1),1,0))))))
 
If I answered your question, please mark it as a solution to help other members find it more quickly.

Hi JPPV20,

this works perfect thank you.

I think I got lost somewhere in between the brackets...

Thomas

HotChilli
Community Champion
Community Champion

To debug an IF statement, reduce it to it's simplest form, make that work and then build it up.

So, for starters, make the first line work. Hint : AND takes 2 parameters

amitchandak
Super User
Super User

@thomasreick , It need to be a measure like

 

Switch(True(),
(AND(Max(Table[tmp])=5), COUNT([Index]) ) >=5,5,
(AND(Max(Table[tmp])=0), COUNT([Index]) ) >=5,4
// Add others
)

 

Add mor conditions as per need

 

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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