The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hey guys,
I'm working on a formula that has multiple IF statements to determine a specific date but I cant get it to work.
Basically I need one date (for each row) on which a certain activity will be planned.
Activity A is the exact date so when that is filled it should use that but if that is not filled (the adres hasn't been planned yet) it should calculated base on the status of Activity B, C and D.
However the outcome of that calculated date could mean that the date is < TODAY and then it should calculate TODAY() + xx (if not it should use the outcome of the first calculation
HC estimated +84 =
IF(Adressen[Activity A]<>BLANK(),Adressen[Activity A],
IF(Adressen[Activity B]<>BLANK()||Adressen[Permission]="YES",
IF(Adressen[Activity B]+84<TODAY(),TODAY()+60,
Adressen[Activity B]+84,
IF(Adressen[Activity C]<>BLANK()|| Adressen[Permission]="YES",
IF(Adressen[Activity C]+120)<TODAY(),TODAY()+80,
Adressen[Activity C]+120,
IF(Adressen[Activity D]<>BLANK()||Adressen[Permission]="YES",
IF(Adressen[Activity D]+180)<TODAY(),TODAY()+90,
Adressen[Activity D]+180
IF(Adressen[Activity D]=BLANK(),
TODAY()+180)))
)
)
Solved! Go to Solution.
@RonaldvdH , personally, I'd use switch for such cases, but, anyway, your measure has a lot if syntax errors. I suppose it should be like this:
HC estimated +84 =
IF (
Adressen[Activity A] <> BLANK (),
Adressen[Activity A],
IF (
Adressen[Activity B] <> BLANK () || Adressen[Permission] = "YES",
IF (
Adressen[Activity B] + 84 < TODAY (), TODAY () + 60, Adressen[Activity B] + 84
),
IF (
Adressen[Activity C] <> BLANK () || Adressen[Permission] = "YES",
IF (
Adressen[Activity C] + 120 < TODAY (), TODAY () + 80, Adressen[Activity C] + 120
),
IF (
Adressen[Activity D] <> BLANK () || Adressen[Permission] = "YES",
IF (
Adressen[Activity D] + 180 < TODAY (), TODAY () + 90, Adressen[Activity D] + 180
),
IF ( Adressen[Activity D] = BLANK (), TODAY () + 180 )
)
)
)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
@RonaldvdH , personally, I'd use switch for such cases, but, anyway, your measure has a lot if syntax errors. I suppose it should be like this:
HC estimated +84 =
IF (
Adressen[Activity A] <> BLANK (),
Adressen[Activity A],
IF (
Adressen[Activity B] <> BLANK () || Adressen[Permission] = "YES",
IF (
Adressen[Activity B] + 84 < TODAY (), TODAY () + 60, Adressen[Activity B] + 84
),
IF (
Adressen[Activity C] <> BLANK () || Adressen[Permission] = "YES",
IF (
Adressen[Activity C] + 120 < TODAY (), TODAY () + 80, Adressen[Activity C] + 120
),
IF (
Adressen[Activity D] <> BLANK () || Adressen[Permission] = "YES",
IF (
Adressen[Activity D] + 180 < TODAY (), TODAY () + 90, Adressen[Activity D] + 180
),
IF ( Adressen[Activity D] = BLANK (), TODAY () + 180 )
)
)
)
)
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
how would the formula work if I would use the SWITCH function ?
If you think that is better I'm open to it
You can play with the function using this article: https://dax.guide/switch/.
Anyway, this is all just syntax sugar, just make sure the syntax is correct.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!