cancel
Showing results for
Did you mean:

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

Helper III

## Calculating Ratio as per category for each project

Hi All,

I need to calculte ratio of each category for every project, PFB the sample data:

 ProjID Category 1 A 1 B 1 A 2 A 2 B

So the ratio for project 1 for both the category is 66:33  since A will be 2/3  and B will be 1/3

for Proj 2 the ratio will be 50:50

I need to use this ratio for other calculation so we need to store this ration in below table:

 Proj ID A Ratio B Ratio 1 2

both tables are join on Proj ID column.

Please let me know if you need more clarification on above scenario.

Thank you for the help and support.

Regards,

2 REPLIES 2
Solution Sage

Please refer to the following DAX query:

```Measure =
VAR a =
DIVIDE (
COUNTROWS ( 'Table' ),
CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table'[Category] ) )
)
RETURN
FLOOR ( a * 100, 1 ) & ":"
& FLOOR ( ( 1 - a ) * 100, 1 )```

The result will like:

Best Regards,

Teige

Helper III

Thank you @TeigeGao 🙂

Announcements

#### New forum boards available in Real-Time Intelligence.

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

#### Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors