Forum Discussion
Calculated column for getting difference between current and previous values
- 6 years ago
rubymaya , with a date table try calculation like these
Last Day Non Continous = CALCULATE(sum('order'[Qty]),filter(all(Table),Table[Date] =MAXX(FILTER(all(Table),Table[Date]<max(Table[Date])),Table[Date])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd(Table[Date],-1,Day))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 :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/ - 6 years ago
Hi Amit,
I cant find the pattern, but sometimes it works when i swap the fields in between, for eg : when i drag the qty, the measure disappear, when i remove the qty it appears back,... see 2 screenshots below appear, then disappear
i have relationship between fact table that we calculate and bridge 'table'
rubymaya , with a date table try calculation like these
Last Day Non Continous = CALCULATE(sum('order'[Qty]),filter(all(Table),Table[Date] =MAXX(FILTER(all(Table),Table[Date]<max(Table[Date])),Table[Date])))
Day behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd(Table[Date],-1,Day))
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 :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
- rubymaya6 years agoHelper III
Hi,
Did you mean, i have to create 2 New Columns?
I have error with the first block :
Would you mind using my tables as example :
Col1 = CALCULATE( sum(Fact_CUST_TB_WIP_BONEPILE_INOUT[QTY]),FILTER(ALL(Fact_CUST_TB_WIP_BONEPILE_INOUT),Fact_CUST_TB_WIP_BONEPILE_INOUT[REPORT_DATE].[Date] = MAXX(FILTER(all(Fact_CUST_TB_WIP_BONEPILE_INOUT), Fact_CUST_TB_WIP_BONEPILE_INOUT[REPORT_DATE].[Date] < MAX(Fact_CUST_TB_WIP_BONEPILE_INOUT[REPORT_DATE].[Date])))))- amitchandak6 years agoSuper User
rubymaya , both are new measures
- rubymaya6 years agoHelper III
Ok, would you tell a little bit what it does, i still cant get the brackets right in the measure,...