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! Learn more

Reply
ju_jacobowiski
Frequent Visitor

DAX - Right result but wrong individual flag.

Hey, guys. I've written a measure with DAX in order to check HOW MANY and WHICH questions meet certain criteria:

questions_block_N1_V1 = 
IF([%_compliance_trabalhista_red] <> 1,

(CALCULATE(
COUNT('5_es_individual_compliance'[id_question]),
'5_es_individual_compliance'[question_class] IN {"red"},
'5_es_individual_compliance'[compliance_status] IN {"False"}, 
'5_es_individual_compliance'[topic_txt] IN {"Trabalhista", "Empregados Próprios", "Consórcio", "Terceiros", "Prestadores de Serviço", "Prevenção de Riscos e Acidentes", "Solo", "Plantio", "MIP", "Adubação", "Gestão", "Queima", "Agroquímicos", "Recursos hídricos", "Floresta"})), 0) +

IF([%_compliance_trabalhista_purple] < 0.75,

(CALCULATE(
COUNT('5_es_individual_compliance'[id_question]),
'5_es_individual_compliance'[question_class] IN {"purple"},
'5_es_individual_compliance'[compliance_status] IN {"False"},
'5_es_individual_compliance'[topic_txt] IN {"Trabalhista"})), 0) +

IF([%_compliance_trabalhista_blue] < 0.5, 

(CALCULATE(
COUNT('5_es_individual_compliance'[id_question]),
'5_es_individual_compliance'[question_class] IN {"blue"},
'5_es_individual_compliance'[compliance_status] IN {"False"},
'5_es_individual_compliance'[topic_txt] IN {"Trabalhista"})))

For the example below, this function gives the result 2, which is correct. But when I add the list of questions to be flagged (so I get to know which ones are these 2), something goes wrong:

bug_powerbi.png

 

It should only show with "1" the questions circled in red. Not sure what I'm doing wrong here. Any help is really appreciated!

 

 

 

1 ACCEPTED SOLUTION
akohli
New Member

Hoi! It looks like you're trying to do quite some operations in that one big query... break it up into 3 dimensions for now and see what each one is answering... perhaps it's an ordering thing? I can't really tell because I can't understand the logic (since you haven't shown all the data.)

 

If the problem is just in the last visual, you circled two reds and the answer is two... so is it perhaps just ADDING instead of taking the mean or something like that?

View solution in original post

2 REPLIES 2
akohli
New Member

Hoi! It looks like you're trying to do quite some operations in that one big query... break it up into 3 dimensions for now and see what each one is answering... perhaps it's an ordering thing? I can't really tell because I can't understand the logic (since you haven't shown all the data.)

 

If the problem is just in the last visual, you circled two reds and the answer is two... so is it perhaps just ADDING instead of taking the mean or something like that?

I closed this topic because it was duplicated, gonna concentrate this discussion here: https://community.powerbi.com/t5/Desktop/Result-of-measure-is-correct-but-it-s-flagging-wrongly/m-p/...

 

Cheers!

Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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