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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
samoberoi
Helper III
Helper III

undefined

Hi,

 

I have data and i created a normal switch statement to show if the amount is greater than 2 million then it should be Green and if between 2 million and 1 million then it should be Yellow otherwise should be Red. This was simple, but i now want to show that what the total financial value of Green category e.g. if it is £1268800 then what should its percentage from the grand total of the Financial values and similarly for the other two categories of Yellow and Red depending on each of their total financial value. So, in a nutshell it should give me the percentage of the total financial value from the Grand total for each Green, Yellow & Red bucket.

Thanks

4 REPLIES 4
Anonymous
Not applicable

Hi @samoberoi ,

Please check the attachment.

vcgaomsft_0-1695118408278.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi,

 

Thanks for your reply with the solution. There are a few things on the measure 'Rate' which i can't understand how that functions and what some of the things within it are e.g how does "C",[Color] and "T",[Total]) and [Color]=_c),[T]) work as showing in your formula below. Sorry, i may not be understanding it better. Please explain it a bit further for me. 

Thanks

 

Rate =
VAR _c = [Color]
VAR _total_by_c = CALCULATE(SUMX(FILTER(SUMMARIZE('Table','Table'[Category],"C",[Color],"T",[Total]),[Color]=_c),[T]),ALL('Table'[Category]))
VAR _result = DIVIDE([Total],_total_by_c)
RETURN
_result
Anonymous
Not applicable

Hi @samoberoi ,

SUMMARIZE('Table','Table'[Category],"C",[Color],"T",[Total])

The code above creates a virtual table like this.

vcgaomsft_0-1695195264244.png
This line is declaring a variable _c and assigning it the value of the current row's color

VAR _c = [Color]

vcgaomsft_1-1695195381027.png
Filter virtual table for rows ('virtual table'[C]) equal to the current row color(variable _c).

FILTER(SUMMARIZE('Table','Table'[Category],"C",[Color],"T",[Total]),[Color]=_c)

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.