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
AB174
Regular Visitor

Require some help with a DAX formula

Hello everyone,

 

I'm extremely new to the DAX and coding world and I'm not sure what formula to use for the result i'm after so bear with me while I try to explain this!. 

 

I'm trying to create a simple pie chart showing the overall percentage of positive and negative outcomes of a survey. All the numbers that are "1 or 2" need to come back as negative and "3 or 4" to come back as positive. Im trying to do this across 8 columns and 22 rows as shown in the image below but can't figure out how to do so. Is there a way to do this?

 

I've also attached an image of how id like the outcome to look like just for a reference if what I said didnt really make sense!

 

Apologies if i'm in the wrong section or haven't made much sense!

 

Many thanksThis is the table i haveThis is the table i havethe outcome that im afterthe outcome that im after

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @AB174 

 

Download sample PBIX file

 

If you use Power Query to Unpivot the table you end up with 2 columns (see my file for details)

donut1.png

 

You can then write 2 measures to count the 'positive' and 'negative' values

 

Positive = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', 'DataTable'[Value] > 2 ))

 

 

 

Negative = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', 'DataTable'[Value] < 3 ))

 

 

Add these measures to your Donut chart

donut2.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @AB174 

 

Download sample PBIX file

 

If you use Power Query to Unpivot the table you end up with 2 columns (see my file for details)

donut1.png

 

You can then write 2 measures to count the 'positive' and 'negative' values

 

Positive = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', 'DataTable'[Value] > 2 ))

 

 

 

Negative = CALCULATE(COUNTROWS('DataTable'), FILTER('DataTable', 'DataTable'[Value] < 3 ))

 

 

Add these measures to your Donut chart

donut2.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.