Forum Discussion

Rana's avatar
Rana
Regular Visitor
10 years ago
Solved

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...
  • Tsanka's avatar
    Tsanka
    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]
    )