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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
siac16
Regular Visitor

Help with Divide

Hi

I currently have a table with the following fields

SourceDo you use it?GenderAgeIncome
InternetYESM18-251000-2000
InternetNOF26-352001-3000
TVYESM36-451000-2000
MagazineNOF18-255001-6000

 

And I created the following measure:

Medida = DIVIDE(COUNTA(M_Medios[Do you use it?]),1052)

 

The 1,052 is because there are 1,052 answers for each source (internet, TV, Magazine)

 

What I'm trying to do is to obtain the percentage of each source that had answered YES in a bar chart.

But when I try to use Slicers the data keeps dividing for 1,052 instead of the new total for each source.

 

For example, If I use a slicer for Males, the Internet should be 100% YES, wherein on the other hand if it is female it will be 0%. But currently, it is showing 50% for Male slicers.

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

Hi, @siac16 

 

A measure could be like this:

Measure = 
var _DIVIDE=
DIVIDE(
    CALCULATE(COUNT('Table'[Do you use it?]),FILTER(ALLSELECTED('Table'),'Table'[Do you use it?]="YES")),
    CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'))
    )
VAR _IF=IF(_DIVIDE=BLANK(),0,_DIVIDE)

RETURN _IF

 Result:

vangzhengmsft_0-1636684496848.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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
v-angzheng-msft
Community Support
Community Support

Hi, @siac16 

 

A measure could be like this:

Measure = 
var _DIVIDE=
DIVIDE(
    CALCULATE(COUNT('Table'[Do you use it?]),FILTER(ALLSELECTED('Table'),'Table'[Do you use it?]="YES")),
    CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'))
    )
VAR _IF=IF(_DIVIDE=BLANK(),0,_DIVIDE)

RETURN _IF

 Result:

vangzhengmsft_0-1636684496848.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

 

amitchandak
Super User
Super User

@siac16 , Try a measure like

 

divide( countrows(Table), calculate(countrows(Table), allselected(Table)) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors