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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
FABIANSMITS
New Member

Sales Measure

Greetings PBI Team

 

I need to calculate the sales according to what is selected in the calendar, for example, if I have selected the year, the sales are calculated based on that selection, and the same for month and day. Here is an example of the measure I have to calculate the sales in the actual month

 

Can you please give me some help on this? thank you so much

 

FABIANSMITS_0-1673902453488.png

 

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @FABIANSMITS ,

 

Please try to add a slicer like this:

vjianbolimsft_0-1673924358023.png

You can achieve your goal by using sum of sales directly:

vjianbolimsft_1-1673924420369.png

Or apply a measure like this:

Measure = 
var _a = SELECTCOLUMNS('Calendar',"Date",[Date])
return CALCULATE(SUM('Table'[Total Sales]),FILTER(ALL('Calendar'),[Date] in _a))

Output:

vjianbolimsft_2-1673924480776.png

 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @FABIANSMITS ,

 

Please try to add a slicer like this:

vjianbolimsft_0-1673924358023.png

You can achieve your goal by using sum of sales directly:

vjianbolimsft_1-1673924420369.png

Or apply a measure like this:

Measure = 
var _a = SELECTCOLUMNS('Calendar',"Date",[Date])
return CALCULATE(SUM('Table'[Total Sales]),FILTER(ALL('Calendar'),[Date] in _a))

Output:

vjianbolimsft_2-1673924480776.png

 

 

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

FreemanZ
Super User
Super User

hi @FABIANSMITS 

how is [actual month] defined?

what issue do you have for the mentioned code?

Ashley the measure is Current Month and is calculated this way:

FABIANSMITS_0-1673922172628.png

and the measure for LAST_DATE_SALES is:

 

FABIANSMITS_1-1673922326319.png

And what i want to do is to adjust my measure so that it can calculate the sales per year, month or day as selected

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors