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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Venkatac
Regular Visitor

If value a is between x and y values then "1" else "0"

Hi all,

I have Column Age and Values and Actual value. if actual value between age rows ,I want to falg as 1 esle 0.

 

For example,

Actual value is 2227 and i want to flag as 1 in 50(Age row) and remaing rows should be 0.

Actual value is 2662 and i want to flag as 1 in 80(Age row) and remaing rows should be 0.

1. I created a calculated measures to get respective values for age (i.e 10, 20,30..90)
10 = CALCULATE(SUM(Table[Values]),Table[Age]=10)
20 = CALCULATE(SUM(Table[Values]),Table[Age]=20)
..up to 90

2.Created a calculated column to Flag

IF(Table[Actual value]<=[10],1,
IF(And(Table[Actual value]>[10],Table[Actual value]<=[20]),1,
IF(And(Table[Actual value]>[20],Table[Actual value]<=[30]),1,
IF(And(Table[Actual value]>[30],Table[Actual value]<=[40]),1,
IF(And(Table[Actual value]>[40],Table[Actual value]<=[50]),1,
IF(And(Table[Actual value]>[50],Table[Actual value]<=[60]),1,
IF(And(Table[Actual value]>[60],Table[Actual value]<=[70]),1,
IF(And(Table[Actual value]>[70],Table[Actual value]<=[80]),1,
IF(And(Table[Actual value]>[80],Table[Actual value]<=[90]),1,
IF(Table[Actual value]>[90],1))))))))))

 

Dax Formula Results   Desired results  
AgeValuesActual valueFlag AgeValuesActual valueFlag
10179222270 10179222270
20193722270 20193722270
30206322270 30206322270
40214022270 40214022270
50224022271 50224022271
60237522271 60237522270
70251222271 70251222270
80272022271 80272022270
90318222271 90318222270
         
AgeValuesActual valueFlag AgeValuesActual valueFlag
10179226620 10179226620
20193726620 20193726620
30206326620 30206326620
40214026620 40214026620
50224026620 50224026620
60237526620 60237526620
70251226620 70251226620
80272026621 80272026621
90318226621 90318226620

 

What am I doing wrong? Any help would be greatlu appreciated.

 

Br,

Ram

1 ACCEPTED SOLUTION

Hi Matt, Thank you!

 

By using Earlier function, i got expected results.

 

Br,

Ram

View solution in original post

2 REPLIES 2

i'm not sure what you are trying to do, but this may help you
https://exceleratorbi.com.au/banding-in-dax/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Hi Matt, Thank you!

 

By using Earlier function, i got expected results.

 

Br,

Ram

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.