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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
BeastHouse
Frequent Visitor

Converting Excel Workbook to Power BI DAX

Hi, I have several big formulas sitting in an existing Excel workbook that I need to transfer over to Power BI, however I have no idea how to convert these ones. Some are using the MATCH function from Excel, others I fear may be too long. If someone can provide some advice on how to make these work in DAX, that would be appreciated.

 

I have more, but I think if I can understand how to acheive the below, it will help with the others.

 

Month of Invoice

 

This one looks at the following new fields in Power BI

 

  • 'Invoice Number' in TEXT format
  • 'Month' in TEXT format

 

=IFERROR(IF([@[Invoice Number]]<>"",TEXT(INDEX(tbl_InvoiceNumbers[Month],MATCH([@[Invoice Number]],tbl_InvoiceNumbers[Invoice Number],0),),"mmmm"),""),"")

 

 

EDD

 

I have put this into Power BI as it looked simple enough, however it did not work.

 

'Quoted EDD' is in DATE format.

 

 

EDD = IF('Stock Orders'[Quoted EDD]="","",IF('Stock Orders'[Quoted EDD]=1,"",'Stock Orders'[Quoted EDD]))

 

 

It receives error DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

Date Ordered

I have put this into Power BI as it looked simple enough, however it did not work either.

 

'Date Submitted' is in DATE format.

 

 

Date Ordered = IF('Stock Orders'[Date Submitted]="",IF('Stock Orders'[PP]="PP1",DATE(2015,7,1),IF('Stock Orders'[PP]="PP2",DATE(2016,7,1),IF('Stock Orders'[PP]="PP3",DATE(2017,7,1),IF('Stock Orders'[PP]="PP4",DATE(2018,7,1),IF('Stock Orders'[PP]="PP5",DATE(2019,7,1),IF('Stock Orders'[PP]="PP6",DATE(2020,7,1),IF('Stock Orders'[PP]="PP7",DATE(2021,7,1),IF('Stock Orders'[PP]="PP8",DATE(2022,7,1),IF('Stock Orders'[PP]="PP9",DATE(2023,7,1),'Stock Orders'[Date Submitted]))))))))),'Stock Orders'[Date Submitted])

 

 

It receives error DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

@BeastHouse 

EDD = IF('Stock Orders'[Quoted EDD]="","",IF('Stock Orders'[Quoted EDD]=1,"",'Stock Orders'[Quoted EDD]))

 

If 'Stock Orders'[Quoted EDD] is of Date type, why would you compare it to '1'?

If you want to check if the field is empty, use Stock Orders'[Quoted EDD] = BLANK()And use the same BLANK() instead of leaving "" when your column is supposed to be of a Date type.

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!

View solution in original post

3 REPLIES 3
ERD
Community Champion
Community Champion

@BeastHouse 

EDD = IF('Stock Orders'[Quoted EDD]="","",IF('Stock Orders'[Quoted EDD]=1,"",'Stock Orders'[Quoted EDD]))

 

If 'Stock Orders'[Quoted EDD] is of Date type, why would you compare it to '1'?

If you want to check if the field is empty, use Stock Orders'[Quoted EDD] = BLANK()And use the same BLANK() instead of leaving "" when your column is supposed to be of a Date type.

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!

Thanks @ERD - I wasn't aware of the BLANK() function. Thats a great help.

 

Do you know how I can also do a MATCH function in DAX? Another formula I am trying to convert from Excel is below. You'll have to forgive me, as I didn't write the original Workbook, so really trying to unjumble what the author had written.


=IFERROR(INDEX(tbl_ProcRep_Stock_CV[Ref],MATCH([@[RFQ ID]],tbl_ProcRep_Stock_CV[RFQ ID],0)),"")

 

ERD
Community Champion
Community Champion

@BeastHouse , check LOOKUPVALUE function (DAX) - DAX | Microsoft Learn

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!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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