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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

DAX Measure and Visual filtering

Hi all,

 

I got stuck trying to figure out how to solve below issue, hope someone can help me out.

 

I have a dataset with sales data, containing a column 'Sales_Price", and a column 'Won' with values Yes/No. 

In my dashboard I show this data in two ways:

 

1. As a count hitrate (simple Donut Chart stating amount of Yes and No)

2. As a conversion rate calculating the $ won as a percentage of the total amount of all possible sales. This is done in a measure (see syntax below) and shown in a Card visual as a single percentage number. 

 

Conversion_Rate = DIVIDE(

CALCULATE(SUM('Sales'[Sales_Price]),'Sales'[Won]="Yes"), 
SUM('Sales'[Sales_Price]))

 

All works well; selecting a Client filter gives me the conversation rate of that specific client - so the denominator SUM('Sales'[Sales_Price]) gets adjusted to any filter selections. However, this becomes a problem when No is selected in the donut chart. Sales[Won] are then divided by Sales Lost and this doesn't make any sense.

So I guess I'm looking for a solution where the Card Visual gets disabled when 'No' is selected in the Donut Chart, or a syntax workaround to show a N/A or Blank text when 'No' is selected in the Donut Chart. But since I'm going back and forth between these two options for a while now, without any succes - I'm open for suggestions. 

 

Cheers, Lise 

 

 

Sales_PriceWon
3000Yes
4000No
2500No
1500Yes
1000Yes

 

 

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Conversion_Rate =
IF (
    SELECTEDVALUE ( Sales[Won] ) = "No",
    "N/A",
    DIVIDE (
        CALCULATE ( SUM ( 'Sales'[Sales_Price] ), 'Sales'[Won] = "Yes" ),
        SUM ( 'Sales'[Sales_Price] )
    )
)

vzhangti_0-1655111644065.png

Is this the output you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Conversion_Rate =
IF (
    SELECTEDVALUE ( Sales[Won] ) = "No",
    "N/A",
    DIVIDE (
        CALCULATE ( SUM ( 'Sales'[Sales_Price] ), 'Sales'[Won] = "Yes" ),
        SUM ( 'Sales'[Sales_Price] )
    )
)

vzhangti_0-1655111644065.png

Is this the output you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Yes, thank you! This is perfect

amitchandak
Super User
Super User

@Anonymous , In the donut chart you should use Won as Legned. and sum(Table[price]) as measure

 

 

Or you need two measure

Won%= DIVIDE(

CALCULATE(SUM('Sales'[Sales_Price]),'Sales'[Won]="Yes"), 
SUM('Sales'[Sales_Price]))

 

Lost %= DIVIDE(

CALCULATE(SUM('Sales'[Sales_Price]),'Sales'[Won]<> "Yes"), 
SUM('Sales'[Sales_Price]))

 

If needed use filter

 

Won%= DIVIDE(

CALCULATE(SUM('Sales'[Sales_Price]),'filter('Sales','Sales'[Won]="Yes")), 
SUM('Sales'[Sales_Price]))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.