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

Barchart showing % sales of each month by total sales for the year based on slicer selected dynamica

Hi all,

 

I am trying to use the bar chart to show the percentage of gross sales in each month for a product compare to the selected year, segment, country.

I created one measure object:  

  • test_measure = SUMX('Financial Sample','Financial Sample'[ Gross Sales ])

The above measure will give me the nominator value accurately when I select the relevant slicer value (Segment, Country, Product, and Date) because PBI will group the total gross sales figure (i.e. based on the selected value in the four slicers) and club the figure into the various month bucket correctly.

percentage_nominator.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

field setting in Power BIfield setting in Power BI

 

 

 

Probem:

As my objective is to show the % gross sales of each month which is I need to divide the Measuare object (i.e. test_measure describe above)  BY the Gross Sales for the whole year (in this case 2014) and also based on other slicers selected value.

Hence, based on the above slicer selected value (i.e. Sector: Government, Country: USA, Product:  Amarilla, and Year: 2014) , the test_measure should have the following DAX coding...

  •  Nominator =  SUMX('Financial Sample','Financial Sample'[ Gross Sales ])
  •  Denominator = SUMX('Financial Sample','Financial Sample'[ Gross Sales ])

Obviously, the above measure will show value 1 in each month in barchart and it is wrong in spite of the DAX function in denominator  will give me the correct value if I do a quick test on the number (see following last figure).

 

Question - 
Unlike the nominator, how do I tell the POWER BI not to club the denominator value into individual month so that each of the gross sales figure in each month (nominator) will be divided by the total denominotaor value (i.e. the whole year value based on slicers value by Segment: Government, Country: USA, Product:  Amarilla, and Date:2014). It seem, POWER BI, treat the denominator calculation as monthly.

 

I tried to use ALL function but I cannot disregard the filter criteria selected in all slicers because the denominator value has to take into consideration of all slicer value NOT only in year value. 

 

I know this problem can be easily resolved if I, first, create a table layout to calculate the denominator value (show value as ==> percentage of grand total) and transfer the calculated table into a Barchart. However, I am just thinking from a DAX perspective to resolve it.

 

I know I miss out something. Hope you can shed some light. Thanks ,,tuffy

 

Compared to the dataset figureCompared to the dataset figure

 

1 REPLY 1
v-danhe-msft
Employee
Employee

Hi @Anonymous,

From your description, I could not figure out which filter you want to apply in your denominator? Or you could refer to use the ALLEXCEPT function for your denominator to meet your requirements:

Reference:https://docs.microsoft.com/en-us/dax/allexcept-function-dax

I suggest you offer me a sample data to have a test and post your desired result if possible.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.