Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Here is the DAX for a Slicer that I am using to show revenue amount based on a carrier selected. If no carrier is selected, ir shows the total value for all of the carriers. How do I get the default value to show as 0 instead? Here is the measure -
Solved! Go to Solution.
Hi @dfox09 ,
You can try this:-
measure =
VAR result =
CALCULATE (
MAXX ( 'FactRFP', [Total Annual Premium & FeesCURRENT] ),
REMOVEFILTERS ( 'DimCarrier' )
)
RETURN
COALESCE ( result, 0 )
--or you can try below
--if(result = blank(),0,result)
--or
--result+0
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @dfox09 ,
You can try this:-
measure =
VAR result =
CALCULATE (
MAXX ( 'FactRFP', [Total Annual Premium & FeesCURRENT] ),
REMOVEFILTERS ( 'DimCarrier' )
)
RETURN
COALESCE ( result, 0 )
--or you can try below
--if(result = blank(),0,result)
--or
--result+0
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
I did have one other question, that I just noticed. The visual starts with no selection, hence the request to have the initial (default) value to 0. However, when I select a client, a list of competing carriers will show up and the value is supposed to reflect that of the incumbent carrier (that is, the carrier that the client currently uses). What is actually happening is that when I select a client, the list of carriers shows up but the value doesn't change from 0, like it should. That may reflect a coding issue in the initial measure. Could you check to see what would cause it not to reflect the incumbent carrier value?
There is no default value setting for slicer as per my knowledge. But you can use ISFILTERED and try change the value. Hope this helps!
Measure Name =
var _ValueCalculated = <... Your Calculation >
RETURN
IF( ISFILTERED( 'FilterTable'[FilterColumn] ), _ValueCalculated, 0 )
https://docs.microsoft.com/en-us/dax/isfiltered-function-dax
Thank you for your offer of help. I tried your suggestion and wondering if I missed something. Here is the code with your suggested setup:
@dfox09 Based on @sevenhills suggestion below would be your ideal code:-
measure =
VAR _ValueCalculated =
CALCULATE (
MAXX ( 'FactRFP', [Total Annual Premium & FeesCURRENT] ),
REMOVEFILTERS ( 'DimCarrier' )
)
RETURN
IF ( ISFILTERED ( DimCarrier[Carrier] ), _ValueCalculated, 0 )
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
That worked! Thank for your suggestion. I will note this and the one you suggested below.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
70 |
User | Count |
---|---|
120 | |
110 | |
95 | |
82 | |
77 |