Forum Discussion
Matrix visual, MoM values shown as zero (Power BI desktop)
- 8 months ago
I created the Relationship, DateTime[Date] to a_InitialData[OrderDate], 1 to many, single direction, and made sure the dates are of the same type (Short date)You mean the columns have the same data type or simply have the same format? Make sure they're both type date, no either type date or datetime.
That aside, the main reason you’re getting an incorrect MoM value is that you’re using one variable inside another while trying to change its filter context. Variables are immutable, so the first two variables will return the same results. Instead of reusing CurrentMonthValue in the second variable, use the SUM expression directly.
Mario_Archontis , seem correct if need based on join date , make sure you use date table in slcier, measure and visual
Try like
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month ))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))
MTD or month level
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]))
With inactive join
calculate( calculate( SUM(Sales[Sales Amount]),USERELATIONSHIP ('Sales'[CreateDate], 'Date'[Date])),DATESMTD('Date'[Date]))