Quantcast
Viewing all articles
Browse latest Browse all 217197

Need to convert whole number to date to then create MTD, QTD and YTD calculations using DAX

Hi, I'm ultimately trying to create MTD, QTD, and YTD calculations in Power BI Desktop using DAX and I'm stuck on the 'pre-step' of converting my date data (TrnYear and TrnMonth, see img) from Whole Numbers to Date values. I tried the DATE and DATEVALUE expressions and did not get the correct solution. 

 

This expression:

Year = DATEVALUE(InvMovements[TrnYear])

Results in this error:

Cannot convert value '2016' of type Text to type Date.

 

DATE is not working becasue it wants more arguments, but I just want the year

Year = DATE(InvMovements[TrnYear])

Results in this error:

Too few arguments were passed to the DATE function. The minimum argument count for the function is 3.

 

Another expression I used didn't throw an error but returned '1905' as the date value for the TrnYear value '2016'.

 

Any help would be very much appreciated!

 

 Image may be NSFW.
Clik here to view.
looking to turn TrnYear and Trn Month into dates
looking to turn TrnYear and Trn Month into dates



Viewing all articles
Browse latest Browse all 217197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>