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
SMC1990
New Member

Filtering bar items without changing percentages.

Hi there,

 

I´m working with a bar graphic that looks like this 

Captura.JPG

This graphic reflects  a table in which we have some information about drugs that have been administered to a set of patients in a determinate clinical context. A very simple example is displayed below in order to illustrate the way data are represented.

Patient_IDItem
11A
11C
13B
14C

 

We have also a table in which all Patient ID`s are collected.

 

Study ID
11
12
13
14

 

The "Item" attribute is placed at the "Axis" dimension in the graphic, and the "Patient ID" attribute of the second table is placed at the "Value" dimension, expresed as a percentage. So that, for each drug, the graphic shows the percentage of patientes that have been medicated with.

 

Well, here comes my doubt. I´m trying to create a filter object that allows to display only the items we are interested in, "hiding" the rest of them without -this is where the problem is- modifying the percentages. For example, if "A"=37,8% and "B"=20,8%, our desired filter would not end up resulting in a percentage change when both options were selected. If I simply create an "Item" filter, selecting a single option leads to a percentage change (100%). Selecting multiple options will lead to the desired result only if all patients have been medicated with at least one of the selected drugs. Is there some way to design a filter that can fit to these conditions?

 

Thanks in advice.

1 REPLY 1
lance_6
Helper II
Helper II

VAR _num = COUNTROWS(<table>) // Will be taken into context with the visual
VAR _den = CALCULATE(COUNTROWS(<table>), ALL(<table>)) //all rows ignoring filters

RETURN
_num/_den

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.