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
Anonymous
Not applicable

(DAX) Show percentage of total

Dear all,

 

Hope you are all well in this hard times.

 

I came accross a task which I dont seem to find a solution (maybe is because I am narrowing and focusing to much over the same thing) but i need your help.

 

The main goal is to have a card or cluster grapg showing the percentage of the total. Let me explain:

 

My data looks something like this:

MonthCountryClientLogistic
JanDEA1Distributed
JanDEA1Distributed
JanDEA1Distributed
JanDEA1Distributed
JanDEA1Distributed
JanDEA1Received
JanDEA1Received
JanDEA1Received
JanDEA1NotReceived
JanDEA1NotReceived
FebDEA1Distributed
FebDEA1Distributed
FebDEA1Distributed
FebDEA1Distributed
FebDEA1Distributed
FebDEA1Received
FebDEA1Received
FebDEA1Received
FebDEA1Received
FebDEA1NotReceived

 

I have various months, customers and countries.

The process flow is that every product is first DISTRIBUTED and then it can be RECEIVED or NOTRECEIVED by the client  ( TOTAL Distributed = RECEIVED+NOTRECEIVED).

 

What i want to extract (and show thru visualizations) is the percentage  of RECEIVED or NOTRECEIVED from DISTRIBUTED per each month.

 

The visualization will look like a cluster graph spread per month and in each month you will see the % of each or the two variables (RECEIVED and NOTRECEIVED) along with a slicer per customer.

 

Now, I assume a have to create a calculated column using DAX to SUM(DISTRIBUTED) and divide RECEIVED and NOT RECEIVED but i dont know how to write it properly.

 

My level in pbi is novice and I kindly need your help in order to get out of this tunnel vision I have.

 

thank you and stay safe.

1 ACCEPTED SOLUTION

@Anonymous , I said for Measure, You are creating a column.

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

Try a new measure like

divide(
calculate(countrows(filter(table[Logistic]<>"Distributed"))),
calculate(countrows(filter(table[Logistic]="Distributed")))
)
Anonymous
Not applicable

Thank you, I get: Too few arguments were passed to the FILTER function. The minimum argument count for the function is 2. 😞

@Anonymous , try like

divide(
calculate(countrows(filter(table,table[Logistic]<>"Distributed"))),
calculate(countrows(filter(table,table[Logistic]="Distributed")))
)
Anonymous
Not applicable

Thank you again @amitchandak ,

 

I get in return a blank column

 
 

Capture.PNG

@Anonymous , I said for Measure, You are creating a column.

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

The measure will look something like.

Measure = 
DIVIDE(
    CALCULATE( 
        COUNTROWS( 'Table' ),
        'Table'[Logistic] = "Distributed"
    ),
    CALCULATE( 
        COUNTROWS( 'Table' ),
        'Table'[Logistic] IN { "NotReceived", "Received" }
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Thank you @Mariusz ,

 

The provided calculation returns a column filled with "1" (or100% if I formate it to %).

 

is this correct?

Hi @Anonymous 

 

The sample that you provided returns 5 records for "Distributed" and 5 records between 

"NotReceived" and  "Received" for both months, so the result will 5/5 this will return 1 or 100% for each month.
 
Hope this helps

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

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.