Forum Discussion

Rakshhit_Sharma's avatar
Rakshhit_Sharma
Advocate I
2 years ago
Solved

Measure formula problem

I am writing some measures to calculate,let's say, sum of sales for past n months [n is 3,6,12,24,36]. All will be shown in cards.

I have data up until feb 2024 , starting from jan 2019

The normal measure for sum is

Sale_Sum = sum(tablename.columnname) 

This one is working fine.

When i tried to make specific measure , something like this:

Sale_Sum_3_months = Calculate(Sale_Sum, filter(tablename,datecolumn <= max(table.datecolumn) && datecolumn >= max(table.datecolumn)-90)). 

Again this is working fine. 

Slicers made of other columns working perfectly fine with this card. But problemcomes with year slicer. In all 5 cases[ 3,6,9,12,36 months ], when i select 2024, it shows data only for jan and feb 24, whereas technically it should sum of 3 months[ dec 23, jan 24, feb 24]. Also for 24, 36 month cases when 1 year is selected, lets say 2023, then only 2023 data is shown instead of showing 2023-22 data for 24 months and 2023-22-21 for 36 months. I tried using "all(tablename)" or "all(tablename.datecolumn" function in first part of filter where tablename is present , but then rest of slicers made from other columns will not work. Only year slicer will work. If i use removefilters(tablename) instead of tablename in filter column, then other slicers will work , but date colum or year slicer will not. Any suggesstions what else can I  try. I will try my best to give fast replies for solving this problem better.

It looks like date column and rest of column slicers working in different directions . One does not work with other. Any suggestion will be helpful

8 Replies