Forum Discussion
Gdibbs
Helper I
4 years agoConditional Column in Dax not calculating as expected
Hi All, I suspect I am missing something very basic and/or obvious. I am trying to do the following... If the column headered "plant" is equal to "US5A" and the month headered "Oct-21" is...
- 4 years ago
Gdibbs , a couple of things:
1) M is case sensitive and spelling counts. You've written two different things:
- [Plant]] = "AS5A"
- "plant" is equal to "US5A"
Which option do you want? A or U?
2) It's difficult to see with your screenshots, as you haven't included the columns in one shot, but the example you did show does not appear to have any data < 1, so that will leave everything as blank (not null - if you want null you need to specify that in your column instead of the empty quotes "").
= Table.AddColumn(#"Filtered Rows", "Custom", each if [[Plant]] = "AS5A" and ([[#"Oct-21"]] < 1) then ([#"Oct-21"] * -1) else null)Otherwise I can't see any obvious errors at a quick glance.
v-kelly-msft
Community Support
4 years agoHi Gdibbs ,
Try:
= Table.AddColumn(#"Filtered Rows", "Custom", each if Text.From([[Plant]]) = "AS5A" and (Number.From([[#"Oct-21"]] )< 1) then (Number.From([#"Oct-21" ]) * -1) else "")
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!