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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Olenkka2894
Regular Visitor

Obtain the percentage of the total (%) in the power bi report view under the context of two differen

hello, I want to get the percentage of the total (%) in the power bi report view under the context of two different filters:
1° Segment
2° Distributor

These filters are applied by slicers and are given in that order.

Applying these filters the total is 18,071,601.56

However, applying multiple formulas, the total (denominator) does not change.

[medida]=Sum(Ventas[Neto a pagar]

1st try:
% de la fila del campo Neto a pagar = divide([medida],calculate([medida],allselected(Ventas[Distribuidor],Ventas[Segmento])))

2nd attempt:

% de la fila del campo Neto a pagar = divide([medida],calculate([medida],allselected()))

3rd attempt:
denominator is total without filters
% de la fila del campo Neto a pagar = divide([medida],calculate([medida],all(Ventas))

I have researched in several sources and have not been able to get the division of:
numerator (whatever is filtered) / the new total or subtotal after all filters. 

11,021,218.32/18,071,601.56

I am supposed to get 60.99% on the display panel card after all filters or 39.01% if I choose "Oeschle" (only clicking on it).

 

I only have one table.

Captura de pantalla 2025-02-09 014958.png

https://community.fabric.microsoft.com/t5/Power-BI-Community-Blog/The-ALL-ALLSELECTED-amp-ALLEXCEPT-...

https://community.fabric.microsoft.com/t5/Desktop/Incorrect-value-in-measure-when-2-or-more-filters-...

https://community.fabric.microsoft.com/t5/Desktop/Card-with-percentage-using-any-filter/m-p/799907#M...

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

@Olenkka2894  thank you.  I have change the link
Click here 

 

As previously mentioned, I believe the correct answer is that it is not possible.

 

I have provided examples how to calculate the correct % at row level in the table visuals.
However, in this scenario you can not click on the row and display that row %  in a card. 


I appreciate it is not the answer you want but it is correct answer.

Please click, the thumps up and the accept solution buttons.

View solution in original post

7 REPLIES 7
speedramps
Community Champion
Community Champion

@Olenkka2894  thank you.  I have change the link
Click here 

 

As previously mentioned, I believe the correct answer is that it is not possible.

 

I have provided examples how to calculate the correct % at row level in the table visuals.
However, in this scenario you can not click on the row and display that row %  in a card. 


I appreciate it is not the answer you want but it is correct answer.

Please click, the thumps up and the accept solution buttons.

speedramps
Community Champion
Community Champion

I am a Super User.

I dont think @Olenkka2894 requirement  is possible with any of the DAX filter overide functions,

https://learn.microsoft.com/en-us/dax/filter-functions-dax

because the users is clicking on one visual and want to change the behaviour on another.

I recommend @Olenkka2894 abandons this method and users filters, tooltips of drilldowns instead.

This will display the correct figures but not in the style and method @Olenkka2894 would like.


If any Super Users thinks it is possible then please use this PBIX from my OneDrive

Click here 

I would be most intested to see how you do it !

 

If no Super Users answer in the next few days then please will @Olenkka2894 accept my solution that this is not possible.

In the meantime please click the thumbs up for me going to the effort of preparing the data on Onedrive. 

 

The think the requirement from @Olenkka2894  is ....

If the users clicks on a row in the on By Distributor visual then they want to display the [% all selected] in the card.
If the users clicks on a row in the on By Segement visual then they want to display the [% all selected] in the card.

Please can @Olenkka2894  confirm we have understood the requirements? 

 

speedramps_2-1739303697552.png

 

speedramps_0-1739303631689.png

 

speedramps_1-1739303676393.png

 

 


@speedramps wrote:

The think the requirement from @Olenkka2894  is ....

If the users clicks on a row in the on By Distributor visual then they want to display the [% all selected] in the card.
If the users clicks on a row in the on By Segement visual then they want to display the [% all selected] in the card.

Please can @Olenkka2894  confirm we have understood the requirements? 

 

speedramps_2-1739303697552.png

 

speedramps_0-1739303631689.png

 

speedramps_1-1739303676393.png

 

 


Yes, I confirm.

 

I have noticed that for example if I click on compilation-right click on value's field-show values as - percentage of the total I get the result of 100% so this not work also.

 

 

Your link does not work. https://1drv.ms/u/c/dbadbed48d511303/EQPXf8nP_7JHkwzZTpwlaxYBzz1we1OuHrJ_bvJjIfYA8g?e=EF9Mzq 

 

Captura de pantalla 2025-02-11 175253.png

speedramps
Community Champion
Community Champion

Download this PBIX solution from my Onedrive
Olenkka2894.pbix

 

speedramps_0-1739113164853.png

We want to help you but your description is too vague. Please write it again clearly.

Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀

Please just give a simple non technical functional description of what you want, then let us suggest the solution. Thank you.

Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.

Remove any unneeded columns which may cause confusion.

Rename columns to user friendly names. Avoid jargon.
Also provide the example desired output, with a clear step-by-step description of calculations the process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.
Remember you are gertting free expert help, so please put lots of proper effort to asking questions and providing examples.

Vaugue descriptions can waste your time and our time.

Look forward to helping you when the above information is forthcoming.

using your example and attaching a video explaining very clearly what I am looking for, I expect expert help but with respect. I think it will help many people the absolution of my question.

Power BI

 
DataNinja777
Super User
Super User

Hi @Olenkka2894 ,

 

Your issue stems from the denominator not dynamically updating based on the selected filters. To correctly calculate the percentage of the total under the context of both Segment and Distributor slicers, use the following DAX formula:

% Neto a pagar = 
VAR TotalFiltered = CALCULATE([medida], ALLSELECTED(Ventas))
RETURN 
    DIVIDE([medida], TotalFiltered)

This formula ensures that the denominator respects the active filters applied by the slicers. [medida] represents the sum of Neto a pagar under the current filter context, while ALLSELECTED(Ventas) ensures that the denominator considers only the total after applying slicers, not the absolute total without any filters. The DIVIDE function safely handles division, avoiding errors when the denominator is zero or blank.

With this measure, when both Segment and Distributor are selected, the denominator will reflect the subtotal based on those filters. If only one distributor, such as "Oeschle," is selected, the denominator remains the subtotal for the currently selected segment. This approach should result in the correct percentage, displaying 60.99% or 39.01% as expected.

If the denominator still does not update dynamically, another debugging approach is to create a measure to check the total across all possible filters:

Total Neto a pagar = CALCULATE([medida], REMOVEFILTERS(Ventas))

Placing this measure in a table visual alongside [medida] can help verify if the denominator is adjusting correctly to slicer selections. Let me know if this resolves the issue.

 

Best regards,

hello, thank you, but this does not work. Attached is the power BI project which belongs to @speedramps and a short video of what I am looking for.

Power BI

Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors