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