Forum Discussion
unable to get dax function previousmonth, previousyear,parallel functions working (tried everything)
Anonymous , Can you change the data type of date as datetime and check there is not timestamp. If time is other than 12:00 AM then create date only column and join with date table
Date only = datevalue([date])
You need to create a measure
CALCULATE(SUM(Databricks[ReturnVisit]), PREVIOUSMONTH('Calendar'[Date]))
But if no date is selected it considers first date and will not give a value.
Example options
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
If no ate is selected then use today
This Month =
var _max = eomonth(if(isfiltered('Date'),MAX( 'Date'[Date]) , today()),0)
var _min = eomonth(_max,-1)+1 ,
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Last Month =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = eomonth(_max1,-1)
var _min = eomonth(_max1,-2)+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
Why previousmonth does not give result when datesmtd is giving it: https://youtu.be/1KkoJehRVeg
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Thanks for your help.
I haven't checked the youtube videos yet, but I have to get previous month for any date that 's in the data so I would have to be able to show previous month as January when the table.
As you can see, i have dates for months going back..and i would hope that in the _previous column, it would show previous months data.