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

Divide filtered value by sum of month (same column)

Hi,

I have a dashboard with a few slicers (date, segment, etc).

I need help to create a measure that divides the outcome of slicers by the sum of the month.
For example, when I choose a date and segment the outcome of sales is 2.000, and the total sales of the selected month are 10.000 then the result has to be 2.000 (with slicer selections) / 10.000 (with a selected month from slicer) = 20%.

Thank you in advance.

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

Hi, @Anonymous 

 

Try to create measures as follows:

 

_sum = SUM('Table'[Sale])
_sumOfMonth = CALCULATE(SUM('Table'[Sale]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
_result = DIVIDE([_sum],[_sumOfMonth])

 

result:

vangzhengmsft_0-1631240562835.png

In addition, I have to say that the measure mentioned by @VahidDM  above can also work and only one measure is used.

vangzhengmsft_1-1631241227841.png

 

Please refer to the attachment below for details. Hope this helps.

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

4 REPLIES 4
Anonymous
Not applicable

Thank you all for your replies! I ll try to make it more clear!! 

I m trying to create the third visual (percentage card) on an easy way.

Selected sales and percentage are dynamic (I prevent Total Sales from changing, because its a stable number).

preview.png

 

Ashish_Mathur
Super User
Super User

Hi,

You should have a Calendar Table with a Year, Month name and Month number column.  Sort the Month number by the Month name column.  Create a relationship from the Date column of your base data table to the Date column of the Calendar Table.  Create 2 slicers for Year and Month name.  Select a Year and Month name.  Write these measures:

Total sales = SUM(Data[Sales])

Total sales in month = calculate([Total sales],all(data[segment]))

Ratio = divide([Total sales],[Total sales in month])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

Try to create measures as follows:

 

_sum = SUM('Table'[Sale])
_sumOfMonth = CALCULATE(SUM('Table'[Sale]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
_result = DIVIDE([_sum],[_sumOfMonth])

 

result:

vangzhengmsft_0-1631240562835.png

In addition, I have to say that the measure mentioned by @VahidDM  above can also work and only one measure is used.

vangzhengmsft_1-1631241227841.png

 

Please refer to the attachment below for details. Hope this helps.

 

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

VahidDM
Super User
Super User

Hi @Anonymous 

 

Try to create a measure with your data like this:

Measure = 
Var _SelectedDate =SELECTEDVALUE('Table'[Date])
Var _MonthSD = month(_SelectedDate)

Var _DateAmount = calculate(max('Table'[amount column],'Table'[Date]=_SelectedDate)
Var _MonthAmount = calculate(sum('Table'[amount column],filter(all('Table'),month('Table'[Date])=_MonthSD
return
_DateAmount/_MonthAmount

 

Change the format of this measure to percentage.

 

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

Appreciate your Kudos✌️!!

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.