Forum Discussion

CarlsBerg999's avatar
CarlsBerg999
Helper V
4 years ago
Solved

Cumulative balance

Hi,

 

I have a very simple Model:

 

 

What i want to do, is have 2 visuals: 

1. Date Filter: The user will select a date 

2. Table: The table will show the cumulative balance for each material on the selected date.

 

 

For some reason, my measure only shows the value on the selected date. Not the cumulative balance before the date.

 

Cumulative Inventory Balance = CALCULATE(SUM('Inventory Balance'[Quantity]),
FILTER(ALLSELECTED(DateTable),
DateTable[Date]<=SELECTEDVALUE(DateTable[Date])))

 

What is wrong with my measure? 

 

  • CarlsBerg999 , I think here you need all

     

    Cumulative Inventory Balance = CALCULATE(SUM('Inventory Balance'[Quantity]),
    FILTER(all(DateTable),
    DateTable[Date]<=SELECTEDVALUE(DateTable[Date])))

     

    or

     

    Cumulative Inventory Balance = CALCULATE(SUM('Inventory Balance'[Quantity]),
    FILTER(all(DateTable),
    DateTable[Date]<=max(DateTable[Date])))

1 Reply

  • CarlsBerg999 , I think here you need all

     

    Cumulative Inventory Balance = CALCULATE(SUM('Inventory Balance'[Quantity]),
    FILTER(all(DateTable),
    DateTable[Date]<=SELECTEDVALUE(DateTable[Date])))

     

    or

     

    Cumulative Inventory Balance = CALCULATE(SUM('Inventory Balance'[Quantity]),
    FILTER(all(DateTable),
    DateTable[Date]<=max(DateTable[Date])))