cancel
Showing results for
Did you mean:
Helper III

## 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!
1 ACCEPTED SOLUTION
Super User IV

@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] ))))

Proud to be a Super User!

4 REPLIES 4
Super User IV

@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] ))))

Proud to be a Super User!

Helper III

@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!!!

Community Support

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

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User IV

@okusai3000 Not 100% sure I follow but it seems like you need something like Open Tickets - https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364#M147

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Announcements

#### Happy New Year from Power BI

This is a must watch for a message from Power BI!