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! Request now

Reply
RvdHeijden
Post Prodigy
Post Prodigy

Trying to transform an excel formula into Dax :)

Hello,

 

Im trying to transform my Excel formula into DAX but obviously it doesn't work.

Can someon help me in transforming this formula into DAX ??

 

Status Civiel = IF(Activiteit="Civiel";IF(taken[Gesloten)<>"";"Gesloten";IF(and(taken[Open]<>"";taken[gesloten]="";"Lopend";IF(taken[begin]<>"";"Gepland";"Nog niet gepland")))))

1 ACCEPTED SOLUTION

Which fields/columns are flagged as Date? For example, if "taken[Begin]" is a Date field, then you can't do a comparison to a text value of "", You would have to use "taken[Begin] <> BLANK()" instead.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

Tough to sort through this, but I think you might want something like:

 

Status Civiel = 

IF(Activiteit="Civiel";
     IF(taken[Gesloten)<>"";
          "Gesloten";
          IF(and(taken[Open]<>"";taken[gesloten]="");
               "Lopend";
               IF(taken[begin]<>"";
                     "Gepland";
                     "Nog niet gepland"
)
)
)
)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

Something like that 🙂

 

it a conditional colum with basically a few options depending on values in a nother column

 

option 1: Activity A is closed = value A

option 2: Activity A is not closed but it's being worked on = value B

option 3: Activity A is not closed and not being worked, but is planned = value C

Option 4: Activity A is not closed, not worked on, not planned = value D

 

In excel its the formula i posted but in Dax  ????

 

your formula returns the following error. shouldn't this formula has a 'SWITCH' in it ?

 

2017-07-24_1453.png

You have an issue with data types. You are trying to compare a Date with a text ("") and you probably need to use BLANK() in place of "" in one of those comparisons.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

im not sure how to correct it, all datatype for dates colums have been checked and have the proper format.

The first question .....IF(Taken[Activiteit]="Civiel"..... is obviously a tekst format but then its checking datevalues

Which fields/columns are flagged as Date? For example, if "taken[Begin]" is a Date field, then you can't do a comparison to a text value of "", You would have to use "taken[Begin] <> BLANK()" instead.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

The Colums Taken[Gesloten], [Geopend] and [Begin] are datecolumns

Ive change my formula so that "" becomes BLANK() but it now reads a syntax error

 

Status Civiel =
IF(Taken[activiteit]="Civiel";
     IF(taken[Gesloten]<>BLANK();
          "Gesloten";
          IF(and(taken[geopend]<>BLANK();taken[gesloten]=BLANK());
               "Lopend";
               IF(taken[begin]<>BLANK;
                     "Gepland";
                     "Nog niet gepland"
                 )
            )
       )
  )

@Greg_Deckler

Just i was posting my reply ive noticed one of the BLANK didnt have the () behind it.

I fixed it and now the formula works......

 

Status Civiel =
IF(Taken[activiteit]="Civiel";
     IF(taken[Gesloten]<>BLANK();
          "Gesloten";
          IF(and(taken[geopend]<>BLANK();taken[gesloten]=BLANK());
               "Lopend";
               IF(taken[begin]<>BLANK();
                     "Gepland";
                     "Nog niet gepland"
                 )
            )
       )
  )

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.

Top Solution Authors