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.
Hello all please see the below calculation and applied on a measure with some filters on visuals externally.
I am not able to achieve 0 when the card is empty. I tried Coalesce and also added +0
Hi @harshagraj ,
Try using the IFNULL or IFERROR function to return 0 when the calculation returns a blank or error:
PF Flag Running = var _a = CALCULATE( COUNTA('Dcms_daily_SAP_dataload_V'[Premium_Freight_Flag]), FILTER( CALCULATETABLE( SUMMARIZE( 'Dcms_daily_SAP_dataload_V', 'Dcms_daily_SAP_dataload_V'[Week_Num], 'Dcms_daily_SAP_dataload_V'[Week_Name] ), ALLSELECTED('Dcms_daily_SAP_dataload_V') ), ISONORAFTER( 'Dcms_daily_SAP_dataload_V'[Week_Num], MAX('Dcms_daily_SAP_dataload_V'[Week_Num]), DESC, 'Dcms_daily_SAP_dataload_V'[Week_Name], MAX('Dcms_daily_SAP_dataload_V'[Week_Name]), DESC ) ) ) Return IFNULL(_a,0)
If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂
@harshagraj Try:
Return
_a + 0
@harshagraj Well, if it was me, I would break that formual into multiple variables in order to debug what is going on internally in that formula. Better yet, I would drop the use of CALCULATE and CALCULATETABLE because they do not appear to be necessary at all. For example, you could use COUNTAX instead of COUNTA. You could use FILTER(SUMMARIZE(ALLSELECTED(...),...),...) for example versus your current construct. And I wouldn't use ISONORAFTER but rather something like >=. That's me though, not sure why you aren't getting a value there in your card visual. For example, something like:
Measure = BLANK() + 0
This will always return 0 in a Card visual. So if your VAR _a is returning blank, then you should end up with a 0. So, something else is going on here but not enough information to know what that is at the moment.
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 |
---|---|
98 | |
97 | |
81 | |
77 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |