cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

% of participation

Good, I'm new to dax but I have a little doubt, I would like to get the percentage of participation from a table, I already have the measures of countingdifferent for the total, but I would like a measure to calculate by its type of "form of payment" and after having calculated it, take your percentage

For the calculation by category I had this idea

PO Count by Payment Method = CALCULATE(DISTINCTCOUNTNOBLANK('2023'[Bigmagic Purchase Order ID]),GROUPBY('2023','2023'[Payment method]))
But when I want to use that same measure to calculate the % of participation I get 100% in all
In the table I detail my doubt also
KevsArteaga_0-1684893936965.png

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

Hi , @Syndicate_Admin 

According to your description, you want to get the percentage of participation from a table.

Here are the steps you can refer to :
(1)This is my test data :

vyueyunzhmsft_0-1685067240711.png

i create a measure to simulate yours.

Measure = SUM('Table'[Value])

(2)Then wen can create two measures like this if one can help you :

Percentage = var _total = SUMX( ALLSELECTED('Table'[Payment method]) , [Measure])
return
DIVIDE([Measure],_total)
Percentage without null = var _total = SUMX(FILTER( ALLSELECTED('Table'[Payment method]) ,[Payment method]<> BLANK()) , [Measure])

 return
 IF(MAX('Table'[Payment method])=BLANK(),BLANK(),
 IF( HASONEVALUE('Table'[Payment method]),
 DIVIDE([Measure],_total) ,1))

 

The result is as follows:

vyueyunzhmsft_1-1685067305651.png

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Thank you very much for the help! I just implemented the measures and it has worked!

v-yueyunzh-msft
Community Support
Community Support

Hi , @Syndicate_Admin 

According to your description, you want to get the percentage of participation from a table.

Here are the steps you can refer to :
(1)This is my test data :

vyueyunzhmsft_0-1685067240711.png

i create a measure to simulate yours.

Measure = SUM('Table'[Value])

(2)Then wen can create two measures like this if one can help you :

Percentage = var _total = SUMX( ALLSELECTED('Table'[Payment method]) , [Measure])
return
DIVIDE([Measure],_total)
Percentage without null = var _total = SUMX(FILTER( ALLSELECTED('Table'[Payment method]) ,[Payment method]<> BLANK()) , [Measure])

 return
 IF(MAX('Table'[Payment method])=BLANK(),BLANK(),
 IF( HASONEVALUE('Table'[Payment method]),
 DIVIDE([Measure],_total) ,1))

 

The result is as follows:

vyueyunzhmsft_1-1685067305651.png

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors