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
vilden
Regular Visitor

How to calculate % in a row

Hello, i have this formula - how to change it to count ratio in all rows, so i need to have 100% in all rows, now i have 100% in total. SUMX in all rows should be 1. Thanks.

Tried KEEPFILTERS, but then error occured

 

vilden_0-1669725892501.png

 

1 ACCEPTED SOLUTION

Try it with the other dimension! 

I can see that the total on the bottom for SUMX is 1, and not the total on the right.

Instead of Allselected(Partner)

Replace with AllSelected(Prevodnik)

 

Pi

View solution in original post

10 REPLIES 10
v-jialluo-msft
Community Support
Community Support

Hi @vilden ,

 

This issue does not seem complicated, maybe you need to filter the data once.

If you can upload sample data, it can be better solved.

You can check out similar cases first:

Solved: Re: Donut Chart Cross Filtering- Showing percentag... - Microsoft Power BI Community

 

Best Regards,

Gallen Luo

Here is sample of data what i used in matrix table:

vilden_0-1669882752230.png

 

pi_eye
Resolver IV
Resolver IV

Hi @vilden 

 

Is this the kind of thing that you are after?

pi_eye_0-1669802351405.png

If so, the filter expression you need is allselected (column).  For the above example, the expression is 

percent = divide([SumOfValue], CALCULATE([SumOfValue],allselected(WareHouse[Year])))
Year is the column header, so calculate will ignore that for the total.
SumOfValue is a sum() expression similar to what you have in your example.
 
If not - please can you illustrate what you are looking for as this will help solve the isssue.
 
HTH,
Pi

 

YES, i need exactly what u described, to count % in a rows, but i tried ur formula and it didnt change the result, why 😞 ?

vilden_0-1669879185250.png

 

Try it with the other dimension! 

I can see that the total on the bottom for SUMX is 1, and not the total on the right.

Instead of Allselected(Partner)

Replace with AllSelected(Prevodnik)

 

Pi

Thanks, that solved it. This is awesome community!

For reference - if you see in my example

Year - is the column headings

percent = divide([SumOfValue], CALCULATE([SumOfValue],allselected(WareHouse[Year])))

You have put the row headings - so just needsd swapping

v-jialluo-msft
Community Support
Community Support

Hi @vilden ,

 

You can try:

 

SUMX =

DIVIDE (
    SUM ( 'KP'[COUNT_DISTINCT_of_K_PODPROD] ),
    CALCULATE ( SUM ( 'KP'[COUNT_DISTINCT_of_K_PODPROD] ), ALL ( 'KP' ) )
)

 

If that's not what you need, upload a sample file to resolve the issue faster.

 

Best Regards,

Gallen Luo

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

Tried this and have 100% in every value, why? 

 

vilden_2-1669879722178.png

 

Thanks for try 🙂 but i need to have it compared in a row, so in all row i need to count it to 100% so for example in first row i need to have 367/414 in percent and 47/414 in percent so sum is 100% in all rows. How can i do it pls?:

vilden_1-1669879391495.png

 

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.

Top Solution Authors