Forum Discussion

shere100's avatar
shere100
Helper II
7 years ago
Solved

Power Bi Filters

Hi, quick question.

 

If there is no data in the result set currently, how do I a build a data set so if / when there is data in that criteria to include in the filter if not then display a 0?

 

I have clicked on advanced filtering, in here I can select if a criteria contains the value but if that valuee does not exist then to appear as zero or blank? In advance filtering there is an 'And' and 'Or' statement but not for a one off filter type that does not exist but if it did then to appear.

 

Please advise.

 

 

  • Anonymous's avatar
    Anonymous
    7 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.

21 Replies

  • TeigeGao's avatar
    TeigeGao
    Solution Sage

    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 

    • shere100's avatar
      shere100
      Helper II

      Hi, thanks for the query. This is what I am looking for. 

       

      Please can you let me know how I execute this please? 

      • Anonymous's avatar
        Anonymous
        Not applicable

        shere100 - This is a good intro to modeling in Power BI. Measures are described in step 5.