cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gwendaline_p Regular Visitor
Regular Visitor

How to calculate a sum depending on only one filter ?

Hi ,

 

Here is an example of what I want :

 

I have the number of purchases by month and by country.

I have two filters : by month and by country.

I choose a month (January 2016) and a country (France) and I want to calculate the sum of purchases for France in January 2016 divided by the sum of purchases for all countries in January 2016.

 

MonthCountryPurchases
January 2016France150
January 2016Italy100
January 2016Belgium250

 

Result : 150 / (150 + 100 + 250) = 30 %

 

How can I do it please ?

 

Thanks for your help !

Gwendaline

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Vvelarde Super Contributor
Super Contributor

Re: How to calculate a sum depending on only one filter ?

hello @Gwendaline_p

 

please try with this dax measure.

 

Insert in a card visual

 

% =
DIVIDE (
    CALCULATE ( SUM ( Table1[Purchases] ) ),
    CALCULATE ( SUM ( Table1[Purchases] ), ALL ( Table1 ) ),
    0
)



Lima - Peru
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




View solution in original post

2 REPLIES 2
Highlighted
Vvelarde Super Contributor
Super Contributor

Re: How to calculate a sum depending on only one filter ?

hello @Gwendaline_p

 

please try with this dax measure.

 

Insert in a card visual

 

% =
DIVIDE (
    CALCULATE ( SUM ( Table1[Purchases] ) ),
    CALCULATE ( SUM ( Table1[Purchases] ), ALL ( Table1 ) ),
    0
)



Lima - Peru
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




View solution in original post

Gwendaline_p Regular Visitor
Regular Visitor

Re: How to calculate a sum depending on only one filter ?

It works perfectly.

 

Thank you,

Gwendaline

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 176 members 2,356 guests
Please welcome our newest community members: