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
Anonymous
Not applicable

Total value of last month selected

Hello, can you help me.

I have a table where I have as sales for data. I want to create a measure that tells me only the total sales for the last month that is selected in the selector.
I tried datedd but it didn't work.

For example if the filter is up to November 28th the measure will bring the value of sales from November 1st to November 28th.
If the filter is up to January 12th that only brings the value of sales from January 1st to January 12th

 

table exemple

 

table_exemple.png


visual exemple
visual_exemple.png

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=CALCULATE([Total sales],DATESMTD('Calendar'[Date]))

There should be a Calendar Table with a relationship between the Date column of your base data table to the Date column of the Calendar Table.  The date/month slicer should be built from the Calendar Table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=CALCULATE([Total sales],DATESMTD('Calendar'[Date]))

There should be a Calendar Table with a relationship between the Date column of your base data table to the Date column of the Calendar Table.  The date/month slicer should be built from the Calendar Table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you so much, it worked perfectly. The problem that my slicer was not using the calendar here when using datasadd or result was blank. Now everything is ok .. Thanks!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.