Forum Discussion
Rana
10 years agoRegular Visitor
Difference between 2 columns
I have a Matrix in PowerBI which is showing data for 2 months (month is a string not a date column like Aug, Sept or any selected 2 months). Matrix shows me Total for both months, instead of Sum i ne...
- 10 years ago
@Rana,
A much cleaner code than the one posted by me before (and deleted) is the following:
PreviousDay = CALCULATE ( SUM (FactData[Employees]); Filter (ALL(FactData[Date]);FactData[Date]=Max(FactData[Date])-1) ) Difference = IF( ISBLANK([PreviousDay]); 0; SUM(FactData[Employees])-[PreviousDay] )
Rana
10 years agoRegular Visitor
Tsanka,
1st column for a particular Date shows total number of Employees, 2nd column is the difference. So in the case of 1st month in the table it shows the same number as it doenst have anything to compare with (should be 0). All other months shows the difference between the month with the previous month.
Tsanka
10 years agoKudo Collector
@Rana,
A much cleaner code than the one posted by me before (and deleted) is the following:
PreviousDay = CALCULATE ( SUM (FactData[Employees]); Filter (ALL(FactData[Date]);FactData[Date]=Max(FactData[Date])-1) ) Difference = IF( ISBLANK([PreviousDay]); 0; SUM(FactData[Employees])-[PreviousDay] )