cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
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.

Captura de pantalla 2020-09-14 a las 15.07.59.png

 

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:
 
Captura de pantalla 2020-09-14 a las 15.14.17.png
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
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] ))))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

4 REPLIES 4
Super User IV
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] ))))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

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

 

Captura de pantalla 2020-09-14 a las 15.41.28.png

 

is it clear?

 

thanks!!!

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


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

@ me in replies or I'll lose your thread!!!

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




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
secondImage

Happy New Year from Power BI

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

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors