Forum Discussion

mlsx4's avatar
mlsx4
Memorable Member
2 years ago
Solved

Difference among years

Hi all!

 

I'm trying to compare my supplies among years. I have created three measures:

 

 

 

Total consumption= SUM(Fact_Invoices[Consumption])
LY_Total consumption = CALCULATE([Total consumption], SAMEPERIODLASTYEAR(Dim_Dates[Date])) 
Diff YoY = [Total consumption]-[LY_Total consumption]

 

 

If no filter is applied, it works fine. But if I want to check all months along the different years it fails. For instance, if I put "July" in slicer, then the table / bar chart only works for 2022 and 2023. I need also to compare 2022 with 2021, 2021 with 2020, and so on...

 

How can I achieve that?

Thank you in advance

  • Finally, I have created a calculated column with RELATED to bring names and make it works. It's not an optimum solution but it is what's working... ğŸ˜…

6 Replies

  • mlsx4 not sure why but it should work. What column do you have on the x-axis?  

    • mlsx4's avatar
      mlsx4
      Memorable Member

      Hi parry2k 

       

      If I use a matrix, I have:

      • In the rows: name of the center, type of consumption (electricity, water...). 
      • In the columns: hierarchy (year, month)- I have also tried to put it separately with same result
      • In the values: the three measures

      And then, as slicers: year, month, center or type of consumption.

    • mlsx4's avatar
      mlsx4
      Memorable Member

      Hi parry2k 

       

      Yes I'm sure. There are no filters in my report except month

      The only difference between your "mimic" report and mine is that I have also field center in the rows (Center and then consumption type). The problem is there for sure, because if I ommit the field it works.

       

      P.S. I have been doing some tests. Center is a dimTable with the code and the name of the center. If I choose the value from there it doesn't work, but if I put the code taken by supplies table it works. However, I need the name. Relationship is 1 to many on the side of fact table. I don't really know what's happening. And what's more, if I reply every step in a new report, it works fine. The problem is that I cannot separate it from the big report.

       

      It is really frustrating!!

      • mlsx4's avatar
        mlsx4
        Memorable Member

        Finally, I have created a calculated column with RELATED to bring names and make it works. It's not an optimum solution but it is what's working... ğŸ˜…