Forum Discussion

okusai3000's avatar
okusai3000
Icon for Helper IV rankHelper IV
6 years ago
Solved

Count last movements until every month

Hello everyone,

 

I am trying to see how was our articles stock at every last day of the month in our company. I have a table where everytime an asset has a movement, it will appear on that list.

 

In other words, I need to count every month, how many assets do we have so far for each model.  For example, this is when I select march. As you can see, my measure is checking the stock of articles that they have movements UNTIL the selected month.

 

and here is the measure. 

 

*Cant Equipos2 =

VAR CurrentDate = (max('Dim Date 2'[Date]))
VAR Results =
calculate(distinctCOUNT('Fact Stock Equipos'[esap_cod]);filter(all('Dim Date');
('Dim Date'[Date] <= CurrentDate)))
RETURN
Results
 
So far, so good. My problem is that I need to make a chart of how was the situation each month. So here is where it becomes tricky, as this measure is ONLY correct for the selected month. I need the measure to RE calculate according to each month. Like this:
 
As you can see here, it's only correct the total (that actually is refering to March), but not the rest of the matrix.
 
How can we fix this?
 
Thanks so much as always!
  • okusai3000 m I think this should work

     

    calculate(distinctCOUNT('Fact Stock Equipos'[esap_cod]);filter(all('Dim Date');
    ('Dim Date'[Date] <= max('Dim Date'[Date] ))))

4 Replies

  • okusai3000 m I think this should work

     

    calculate(distinctCOUNT('Fact Stock Equipos'[esap_cod]);filter(all('Dim Date');
    ('Dim Date'[Date] <= max('Dim Date'[Date] ))))

    • okusai3000's avatar
      okusai3000
      Icon for Helper IV rankHelper IV

      amitchandak Great, we are almost there! Now I only need to show that in the matrix  until the selected one. I think it must be related to using the 'Dim Date 2' but I just can't see it...

       

      So far with your measure, If I select one month it shows me that month isolated. If i break the interaction, it shows me right calculation for every month, but I only want to show until the selected month... For example here with march.

       

       

      is it clear?

       

      thanks!!!

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi okusai3000 ,

        Could you please provide some sample data which applied on your matrix and your desired result with examples? The field 'Dim Date 2'[Date] be applied on slicer? 

        Best Regards

        Rena