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
PowerVisualBI
Helper I
Helper I

Show All Value in Donut Chart with DAX

Hello all
I have a problem with DAX
I have slicer company and month for 3 companies. But there is a need to add one option in the slicer company which is "Consol". When I press the console, then all the values will appear as shown on the donut chart now.

PowerVisualBI_0-1660456757047.png

 


I need a DAX formula when I press a company in a certain month, then the donut chart will display the revenue from that company (I have made a DAX formula). But if I press the console, it will display all the revenue values of each company.
Thanks you

The following is the file
https://drive.google.com/file/d/1nlZhVeagoqqgaCfe5gU6mkKN7Kkd0GYJ/view?usp=sharing

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

In that case, you still need the disconnected slicer with

 

CompanySlicer = DISTINCT(Table1[Company])
 
and the updated measure (using your original Table1 column in the visual).
 
NewMeasure = var companyselections = DISTINCT(CompanySlicer[Company])
var table2companies = DISTINCT(Table1[Company])
return IF("Consol" in companyselections, CALCULATE(SUM(Table1[Revenue]), Table1[Company] in table2companies), CALCULATE(SUM(Table1[Revenue]), KEEPFILTERS(treatas(companyselections, Table1[Company]))))
 
mahoneypat_0-1660524217168.png

 

 

Pat
 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

7 REPLIES 7
mahoneypat
Employee
Employee

In that case, you still need the disconnected slicer with

 

CompanySlicer = DISTINCT(Table1[Company])
 
and the updated measure (using your original Table1 column in the visual).
 
NewMeasure = var companyselections = DISTINCT(CompanySlicer[Company])
var table2companies = DISTINCT(Table1[Company])
return IF("Consol" in companyselections, CALCULATE(SUM(Table1[Revenue]), Table1[Company] in table2companies), CALCULATE(SUM(Table1[Revenue]), KEEPFILTERS(treatas(companyselections, Table1[Company]))))
 
mahoneypat_0-1660524217168.png

 

 

Pat
 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi Sir @mahoneypat 
I tried based on your input, but still can't sir. the result is like this, I tried to check in one month, it didn't work. And if you just select the console without selecting the month, the result is the same as this

PowerVisualBI_0-1660530810457.png

 

PowerVisualBI_1-1660530826800.png

 


Or maybe can you send the file to me sir? for me to try to analyze.
Thanks sir @mahoneypat 

Please see the file.

https://drive.google.com/file/d/1K25HgbvCA9Kub0LGtx2DlgHDV2dYHg0t/view?usp=sharing

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Sorry sir @mahoneypat , you enabled sensitivity label in Power Bi File, so I can't login
Can you delete it? I would be very helpful if you did. Thank you

Good to confirm that feature is working. My bad. I changed it to Public and updated the link in previous post.

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Employee
Employee

One way to do that would be to first remove the "Consol" row from your data table, then make a disconnected table that has the Company names and "Console" (one way to do that is with UNION like below).

 

CompanySlicer = UNION(DISTINCT(Table2[Company]), {"Consol"})
 
Also, you don't need to make 3 separate measures. A single measure will work and let the visual create the filters you need for each company.
 
NewMeasure =
VAR companyselections =
DISTINCT ( CompanySlicer[Company] )
VAR table2companies =
DISTINCT ( Table2[Company] )
RETURN
IF (
"Consol" IN companyselections,
CALCULATE ( SUM ( Table2[Revenue] ), Table2[Company] IN table2companies ),
CALCULATE (
SUM ( Table2[Revenue] ),
KEEPFILTERS ( TREATAS ( companyselections, Table2[Company] ) )
)
)
 
Note that the original Company name field is used in the visual and the disconnected table is used in the slicer.
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks for the answer sir @mahoneypat 
Actually the choice of the Company Console also has its own value. But I don't show the value, because I want the value for the company console options from the other three companies. That's why I wrote it has no value like the picture below.

PowerVisualBI_0-1660518242006.png

I can't delete the console row from the table and create a disconnected table because this will affect other visualizations.
I just want when I click the console option that appears is the Revenue value of the three companies from the existing DAX formula.
Could you give me a hint?

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.