Forum Discussion
Power Bi Filters
- Anonymous7 years ago
You're welcome. Thinking a bit more about this. The solution will work, but I don't think it's the most elegant way.
You're talking about expected statuses that don't actually exist. But actually, you know what the statuses will be, right?
You can add another table, with the list of expected statuses.
Then create a Relationship between this table and your current table. That relationship will cause the existing table to be filtered by the new.
Create the following visual to show all statuses:
1. Table visual with the Status from the new table, and the Count of Status measure.
2. Right-click the Status field, and click "Show items with no data".
Each row in the table is a status - since the new table filters the existing, the existing table is limited to only the rows with that status.
Hi shere100,
According to your description, my understanding is that you want to display 0 or blank in visual when no data matches the filter.
In this scenario, we can use the count() function to do that, please refer to the following query:
Measure = var a = FILTER(Data,Data[Date] = DATE(2019,02,01)) return IF(COUNTROWS(a) = 0,BLANK(),CALCULATE(MAX(Data[Data]),a))
Best Regards,
Teige
Hi, thanks for the query. This is what I am looking for.
Please can you let me know how I execute this please?
- shere1007 years agoHelper II
If the table is called 'Test' and the field is called 'Test Result' and the filter 'passed' did not exist, in this instance I would want the display to be '0'. Please can you construct the query for me?
Would I have to create a measure query for each status if they do not exist and I would like a zero to appear for the field 'Test Result'?
- Anonymous7 years agoNot applicable
shere100 -
You could create a measure like this:
My Measure =
var a = SUM('Test'[Test Result])
return IF(ISBLANK(a), 0, a)
What is does: loads the value into variable a.
Returns 0 if a is blank, otherwise, a.
This measure should work everywhere - No need to create more than 1! :smileyhappy: The SUM function adds up all of the values in your column AFTER the column is filtered based on your selections. So, in a table, every cell that includes this value is filtered by whatever attributes are on the rows, etc. and also any slicers applied in other slicer visuals.
- shere1007 years agoHelper II
Hi, thanks for the response.
I have created the visual as well as the measure using the query supplied.
How do I now apply this to the donut chart visual? once I select the measure how to I enforce?
With this measure to the donut visual, where the filter does not exist a 0 will be displayed as per query in the measure. How do I apply please?