Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculate+filter+max error

I am just using below formula to calculate Rev/Sqft by  Catogory  by DataMth (data month)

00This_month_R.S = CALCULATE( ('Table'[00Rev]/'Table'[Sqft]),filter(ALLSELECTED('Table'),'Table'[DataMth]<=max('Table'[DataMth])))
I found that when I choose one catogory, then answer is correct, totally the same with excel answer.
 DataMth   
Catogory201911201912202001202002
A705.2295705.2643528.5895448.5803

But when I choose all catogory, found that all column data are the same, did not filter  by catogory, is anything missed in my formula ?  thanks a lot.

 

 DataMth   
Catogory201911201912202001202002
A393.8481424.5263373.781337.5545
E393.8481424.5263373.781337.5545
G393.8481424.5263373.781337.5545
H393.8481424.5263373.781337.5545


 

  • Anonymous 

    00This_month_R.S = CALCULATE( ('Table'[00Rev]/'Table'[Sqft]), filter(ALLEXCEPT('Table', 'Table'[Catogory]), 'Table'[DataMth]<=max('Table'[DataMth])))

4 Replies

  • az38's avatar
    az38
    Community Champion

    Anonymous 

    00This_month_R.S = CALCULATE( ('Table'[00Rev]/'Table'[Sqft]), filter(ALLEXCEPT('Table', 'Table'[Catogory]), 'Table'[DataMth]<=max('Table'[DataMth])))
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, it does work!

  • Anonymous 

    Move month into a separate table

    Try

    This_month_R.S = CALCULATE( divide('Table'[00Rev],'Table'[Sqft]),filter(ALLSELECTED('Month'),'Table'[DataMth]<=max('Month'[DataMth])))

    Or
    This_month_R.S = CALCULATE( divide(sum('Table'[00Rev]),sum('Table'[Sqft])),filter(ALLSELECTED('Month'),'Table'[DataMth]<=max('Month'[DataMth])))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, I tried, but seems result is not correct, smaller more than it should be.