Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
okusai3000
Helper IV
Helper IV

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
amitchandak
Super User
Super User

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

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

@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.
Greg_Deckler
Super User
Super User

@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!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.