Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Help with converting IF, ISNUMBER excel funtiotion into Power BI

Hello, 

 
I am trying to create the following formula in power BI.  I try to break it down and try to use it by IF and Switch. I was not able to get the result I want. Can anybody please help me with this? 
 
Screenshot of excel with the column.
Capture.PNG

 

Formular 
=IF(ISNUMBER($K2),$K2-$J2,IF($J2>TODAY(),"",TODAY()-$J2))
 
Thank you so much
 
 
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@danzidpp

https://community.powerbi.com/t5/Community-Blog/Excel-to-DAX-Translation/ba-p/1060991

The DAX functions are identical to the Excel functions in your case, so:

Column = 
  IF(ISNUMBER([Column K]),
    [Column K] - [Column J],
    IF([Column J] > TODAY(),
      "",
      TODAY() - [Column J]
    )
  )


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
amitchandak
Super User
Super User

@Anonymous , if J is number that it can not be compared with today and if it is then you need to return same type data

 

try like

Column =
IF(isnumber([Column K]),
[Column K] - [Column J],
IF([Column J] > TODAY(),
blank(),
datediff(TODAY() , [Column J], day)
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak thank you , Its good to know that I can use excel funtion on power BI, but I am getting an error both my date colunms are formatted to date. Not sure why is that. Any Idea?

Capture.PNG

Not sure what this is translating to spanish. hopefully you can see it english

ryan_mayu
Super User
Super User

@Anonymous 

please try this

Column = if(ISNUMBER('Table'[record date]),'Table'[record date]-'Table'[date],if('Table'[date]>today(),blank(),today()-'Table'[date]))




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thank you, but I am getting error. Please see below if you know anything

Greg_Deckler
Community Champion
Community Champion

@danzidpp

https://community.powerbi.com/t5/Community-Blog/Excel-to-DAX-Translation/ba-p/1060991

The DAX functions are identical to the Excel functions in your case, so:

Column = 
  IF(ISNUMBER([Column K]),
    [Column K] - [Column J],
    IF([Column J] > TODAY(),
      "",
      TODAY() - [Column J]
    )
  )


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...
Anonymous
Not applicable

@Greg_Deckler  Good to know that I can use excel funtion, but i ma getting an error when I do that. (Both my Due Date and Actual Delivary Date are on Date format). I am not sure what is variant-type cannot be used. Any idea? Thank you 

 


Capture.PNG

@Anonymous - Yes, you will need to either always return text or numbers. You formula returns text sometimes and numbers other times, that is not allowed in DAX. So you can either replace your "Other" with 0 or some other number.



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...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.