cancel
Showing results for
Did you mean:
pineapple77 Frequent Visitor

## DAX formula for percentage with filter

Hello,

I have stucked on that DAX formula and i would love to get some help I want to visualise a percentage from the total of the same column.

I need the first value of the same column filtered to divide it to the original value of the same column, multyplied by 100 to get percentage.

I used CROSSFILTER and some other functions but i couldn't come up with a result.

I made a measure of the original value so i ca use it and called it "Percentage" and made a Crossfilter that looks like this but it doesn't work (" Percentage2 = CALCULATE([Percentage]; CROSSFILTER('Diversion_type (done)'[Weight];'_Diversions 2017/09'[Number];OneWay)) ")

Thank you!

Best Regards,

Pavlin Ivanov

2 REPLIES 2 v-sihou-msft
Moderator

## Re: DAX formula for percentage with filter

@pineapple77

Can you share some sample data?

In this scenario, if you just need to calculate the percent to total for current row value, you just need to specify ALLSELECTED() as filter to get the total. So your percentage measure can be like:

`Percentage=SUM([Measure])/CALCULATE([Measure],ALLSELECTED(Table))`

Regards,

pineapple77 Frequent Visitor

## Re: DAX formula for percentage with filter  Hello,

Here is some sample data.

The column that i have to filter is located in (Diversions 09/2017) [Count] and i have to filter it by (Diversion Weight) [weight] which column is in another table. I have to get the SUM of [count] before the filter and the SUM of [count] after the filter.
Can i get the values this way or if you can give a tip how to do it another way.

Thank you,

Pavlin Ivanov