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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Percentage based on Field Parameter in Matrix

Hello everyone,

 

Sorry if there is some information is lacking but this is actually my first time posting in here!

 

I am having a bad time writing a measure to calculate the % based on Field Parameters and I was wondering if someone has already done something similar successfully.

 

I have created a sample data and I will be using it in the following examples, the file I am currently using for these tests can be downloaded from here: https://drive.google.com/file/d/1qUChGKX3KiUA6XFuYbphpeYyoYPgBFZn/view?usp=drivesdk.

 

My visual currently looks like this:

bferraz_0-1689251347611.png

 

The matrix visual is designed like this:
Rows: Country, Parameter

Columns: Year

Values: ID (count), Measure

-------

Measure: 

0_MEASURE =
DIVIDE (
CALCULATE (
COUNT(TB1[ID])
),
CALCULATE ( COUNT(TB1[ID]), ALLSELECTED ( ), GROUPBY(TB1, TB1[Year])
))
 

------

The Field parameter uses the following columns: Battery, Bluetooth, Color, Shape, Type and Wi-fi.

 

The slicer also has the Field Parameter values included so I can filter which Field I want to see in the matrix, in the order I selected them.

 

In this case I have filtered first "Wi-fi" and then "Color". The expected result in this case would be Blue with 50% and Red with 50% as well since there are only 2 values and 100% in the with Wi-fi right above since there is no without (instead of 66,67%). Basically I would like the % to be calculated based on the current level of the Field Parameter. I tried using INSCOPE but I had no success and also for having more than 400 values in Field parameter it would be a problem to add all of the columns in the measure. Does anyone know if it would be possible to dinamically calculate it?

 

bferraz_1-1689252320212.png

 

Sample data:

 

IDYearDescriptionColorShapeBatteryBluetoothWi-fiTypeCountry
12021Description 1RedSquarewithwithoutwithT1US
22019Description 2RedCirclewithoutwithoutwithT1Germany
32023Description 3BlueCirclewithwithwithoutT3Germany
42020Description 4PurpleTrianglewithwithwithT2Spain
52020Description 5RedSquarewithwithoutwithT1US
62019Description 6BlueTrianglewithoutwithwithoutT1Spain
72019Description 7BlueSquarewithoutwithoutwithoutT2Germany
82023Description 8PurpleSquarewithoutwithwithT2Spain
92021Description 9RedTrianglewithwithwithT3US
102020Description 10BlueCirclewithoutwithwithT2US
0 REPLIES 0

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 MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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