Forum Discussion
DAX - multiple conditions
Hello
I'm trying to do simple filtering using multiple conditions. At least I thought it would be easy.
Here are the columns:
| Amount | AmountLeft | EndDate | status |
| 100 | 50 | 2016.12.31 | closed |
| 100 | 0 | 2016.12.31 | closed |
| 100 | 50 | 2017.01.31 | active |
I try to make DAX for Status column, which would work simple way:
if Amount <> 0 and AmountLeft > 0 and EndDate > TODAY - status is active
if any of conditions are not fulfilled, status is closed
I tried to use:
Status = IF(Query1[Amount] = 0 || Query1[AmountLeft] < 0 || Query1[EndDate] <TODAY(); "CLOSED"; "active")
but it doesn't work properly.
I'd be obliged if someone could help.
I guess it works fine now in this version
Status = IF(Query1[BonusAmount] = 0 || Query1[BonusLeft] < 0 || Query1[EndDate] < TODAY() && Query1[EndDate] <> BLANK(); "CLOSED"; "active")
Am I right?
9 Replies
- BaskarResident Rockstar
It working fine for me.
Check the date coolumn which datatype it is ?
create Calculated column .
Let me know what error if u getting.
- C4YNelisAdvocate III
I think you want to write it like this:
status = If(Query1[BonusAmount] = 0 || Query1[BonusLeft] <= 0 || (Query1[EndDate] < TODAY() || Isblank(Query1[EndDate])),"Closed","Active")
It's a subtle difference, but otherwise you might still see the wrong lines when your BonusLeft ends up 0. (this scenario was not present in your sample data).
Best Regards,
Niels