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

Dax comparision not working

Hi,

 

Iam performing a calculation in a column which used selectedvalue() dax applied on 3 different filters, but the column result value is not as expected.

 

I have 3 measures using selectedvalue() dax which areso1,selectedtop1,selectedbottom1.

In a new column im calculating like if value is in between selectedtop1 and selectedbottom1, it checks o1s (if o1s =1 then 1 else 0),else it is assigned 2.

 

DAX:

proposedScreen=
IF('Reports vw_Screen1'[Screen 1 Top Level] >= [selected1bottom] && 'Reports vw_Screen1'[Screen 1 Top Level]<=[selected1top],
IF([selectedO1status]=1,1,0),
2)
 
 

 

The problem the new columns value is always 0.

 

Am i doing anything wrong? please help me !

 

Thanks,

Sai Priya.

1 ACCEPTED SOLUTION

Hey @Anonymous ,

 

it would help if you show the approach you tried 😉

In general you can use a measure for the conditional formatting. A measure just always needs an aggregation.

 

Maybe try the following measure for your case:

proposedScreen =
SWITCH(
    TRUE(),
    MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) >= [selected1bottom] && MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) <= [selected1top] && [selectedO1status] = 1, 
    1,
    MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) >= [selected1bottom] && MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) <= [selected1top],
    0,
    2
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @selimovd ,

 

Thank you for your reply !

Iam using the column so that I could use it in conditional formatting for the table .

I have created the table to show all the values of Screen 1 Top Level and based on the value of the new column., iam giving the colour formatting to the table values.

 

I tried creating measure too but it gives an error.Can you suggest me any other tips or tricks.

 

Thanks,
Sai Priya.

Hey @Anonymous ,

 

it would help if you show the approach you tried 😉

In general you can use a measure for the conditional formatting. A measure just always needs an aggregation.

 

Maybe try the following measure for your case:

proposedScreen =
SWITCH(
    TRUE(),
    MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) >= [selected1bottom] && MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) <= [selected1top] && [selectedO1status] = 1, 
    1,
    MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) >= [selected1bottom] && MAX( 'Reports vw_Screen1'[Screen 1 Top Level] ) <= [selected1top],
    0,
    2
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

selimovd
Super User
Super User

Hey @Anonymous ,

 

calculated column are static. 

When the file is loaded the formula will be executed once and the result will the value for each row. So when you use slicers or something similar to get a dynamic result it won't work with calculated columns. They will not change anymore after the first load.

 

If you want dynamic change you have to use a measure as this is re-calculated with every change like the selection of a slicer.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

 

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