Forum Discussion
Displaying a Blank for a Date Calculation
- 5 years ago
Hi Anonymous
DAX and M (Power Query) are different languages and you can't use the same commands in both. The DAX code I supplied
Column = IF( OR( ISBLANK([Last Received Date]) , ([Last Received Date] - [Scheduled Date]) < 0 ), BLANK() , [Last Received Date] - [Scheduled Date] )will not work in Power Query.
It's a completely different set of function names and syntax.
Thats why I supplied a PBIX file with some code in Power Query that does what you want using this code to create a Custom Column
= Table.AddColumn(#"Changed Type", "Days Early or late", each [Last Received to Stock] - [Scheduled Due Date])You need to download my PBIX file and look at the code in Power Query then try to apply it to your code.
If you can't get it to work I can't do much more without seeing your Power Query code and at least a sample of your data in Power Query.
Regards
Phil
Anonymous
So you are doing this in Power Query? Your original post showed DAX code?
Please show some of your data by providing the PBIX file or copy/paste some data I can work with.
Regards
Phil
- Anonymous5 years agoNot applicable
I'm happy to use either, as long as I can get it to work. I am still new at this, and have difficulties differentiating between DAX and Power Query code at times, so I always try solutions in both to see where they work.
If I try your code in DAX, I get errors that it can't find the fields marked. Even if I populate the Table name at the beginning, it gives errors concerning the fields.
I've tried modifying the code (and other code) in Power Query - just different errors. Below is an example of what I have working so far - a custom column created in Power Query is calculating the information mostly correctly. It just has a problem with product that is scheduled to be delivered later this month and no last receive date yet.