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
DemoFour
Responsive Resident
Responsive Resident

Help with DAX IF statement error

Hi peep's I need some help to see what I have done wrong, I am new to this and I'm still learning DAX.

 

I am adding a measure to my table to give me an age category for KPI's.

 

Age Category = if('PBO test 1 - Client Details'[Age]=blank(),blank(),if('PBO test 1 - Client Details'[Age]<18,"16-17",if('PBO test 1 - Client Details'[Age]<20,"18-19",if('PBO test 1 - Client Details'[Age]<22,"20-21",if('PBO test 1 - Client Details'[Age]<24,"22-23",if(‘PBO Client Details’[Age]<25 ”24”,”>25”)))))

 

Whilst we record the individual ages, the KPI asks for a count of 16-17, 18-19, 20-21, 22-23, 24 and 25.

 

So the column [Age] is just a list of numbers = for each clients age.

 

This is what I get

 

DAX Error.PNG

 

Any help to point me in the right direction gratefully received.

1 ACCEPTED SOLUTION
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @DemoFour,

With your measure, you could not just use the column ['PBO test 1 - Client Details'[Age]], you could try to convert the 'PBO test 1 - Client Details'[Age] to CALCULATE(SUM('PBO test 1 - Client Details'[Age])) in your formula.

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @DemoFour,

With your measure, you could not just use the column ['PBO test 1 - Client Details'[Age]], you could try to convert the 'PBO test 1 - Client Details'[Age] to CALCULATE(SUM('PBO test 1 - Client Details'[Age])) in your formula.

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-danhe-msft

 

Thank's for your reply.

 

I got the following to work

 

 DAX Error 1.PNG

 

But whilst the suggestion you made worked, I could not traslate it into visual. I think I need to do some more work on understanding CALCULATE and SUM to understand them better within BI.

 

DAX Error 2.PNG

 

kind regards

Hi @DemoFour ,

It is pleasant that your first issue could be solved, could you please mark my reply as answered if possible?

And with your second issue, I suggest to you to re-create a topic in the community and you could also refer to below link about CALCULATE:

https://www.absentdata.com/power-bi/how-to-use-calculate-in-power-bi/

https://databear.com/power-bi-tips-calculate-one-of-the-most-used-dax-functions/

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.