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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mbailey
Helper II
Helper II

How to calculate the percentage of total items using the count of a group

I'm trying to figure out how to calculate the percentage of total items the count of a group is. Example data below. Each contract can have one of several possible serv_type values. In the example below there are 15 total items and 7 of them are FS.  So the FS's are .46 % of the total count (7/15).

 

I'm using a Direct Query so I can create another intermediary table for this.  Ultimately I'd like to create a visualization showing the resulting percent of total items for each serv_type group. 

 

contract | serv_type
16718 | FS
16716 | FS
16715 | PM3
16713 | FS
16712 | FS
16711 | FS
16710 | FS
16709 | FS
16708 | WA
16707 | WAP
16706 | WA
16705 | PM3
16704 | WAP
16703 | WA
16702 | WA

 

Thanks,

Mike

7 REPLIES 7
hthota
Resolver III
Resolver III

Report Pic:

mbailey.PNG

hthota
Resolver III
Resolver III

Hi,

 

This link doesn't work for me. It just keeps "spinning" saying Working/Loading.

 

Mike

Is it the requriment you need.

Yes, but the link you sent explaining how to do it doesn't work.

 

Mike

Get the file from this Link.

 

I hope i would help you.

Link: https://drive.google.com/open?id=1XE9NBo03E8zRsJe3F7AliGMxjXPwrO4o

Hi,

 

Thank you for sharing your report, but unfortunately, that will not work.  First, as I mentioned, I'm using a Direct Query - connected to a database with live data that constantly changes. In your example, you created a table with two extra columns that I don't have - Count, and Total Type Count. PB will also not net you create additional "work" tables when your starting source is a Direct Query. I also can not create additional columns. You get the error "Function 'COUNT' is not allowed as part of a calculated column DAX expressions on DirectQuery models."

 

I need some kind of formula/measure that will first group and then return the count of each serv_type.  I can then use that to calculate the percentage.  In plain language: DIVIDE( the count of serv_type grouped by serv_type, the total Contracts count)

 

Mike

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.