Forum Discussion

Zyg_D's avatar
Zyg_D
Continued Contributor
6 years ago

Making a blank row visible using an explicit condition

This is my data (the relationship is one-to-many):

 

 

I try to make all three rows visible while also having a condition on the 'Year' column. This column is set to 'Don't summarize'. It works fine without any condition on this column, but as soon as I create one, I lose the empty row.

I have enabled the option "Show items with no data". I have also tried "is blank" and "is 0" with no success.

 

 

This is the desired result:

 

10 Replies

  • Get rid of that "both" direction of the relationship, it's an ugly way of being able to filter your "dim" table through the "fact" table. Then create a measure like this, and you will get the desired result:

    CountRowsTable1 = 
    CALCULATE ( 
        COUNTROWS ( Table1 ),
        CROSSFILTER (
            Table2[ID],
            Table1[ID],
            BOTH
        )
    )

     

     

    I'm not sure about the "Total", it should be 2 not 3 by your logic.

    • Zyg_D's avatar
      Zyg_D
      Continued Contributor

      Arklur wrote:

      Get rid of that "both" direction of the relationship, it's an ugly way of being able to filter your "dim" table through the "fact" table. Then create a measure like this, and you will get the desired result:

       

      CountRowsTable1 = 
      CALCULATE ( 
          COUNTROWS ( Table1 ),
          CROSSFILTER (
              Table2[ID],
              Table1[ID],
              BOTH
          )
      )

       

       

       

      I'm not sure about the "Total", it should be 2 not 3 by your logic.


      Thanks for the answer.

      1. So the filter direction generally should go from "dim" table to "fact" table?

      2. The total should be 3. 

      • Arklur's avatar
        Arklur
        Resolver II

        Yes, the relationship should be "single" and 1:N, 99% of the time at least.

         

        It's hard to give you the exact answer without knowing the specifics (it doesn't make too much sense for me to include a row in the total that is filtered out in the specific rows), but something like this will work:

        CountRowsTable1V2 = 
        IF ( 
            ISINSCOPE ( Table2[Year] ),
            CALCULATE ( 
                COUNTROWS ( Table1 ),
                CROSSFILTER (
                    Table2[ID],
                    Table1[ID],
                    BOTH
                )
            ),
            COUNTROWS ( Table1 )
        )

    • Zyg_D's avatar
      Zyg_D
      Continued Contributor

      az38 wrote:

      Zyg_D 

      for me it works ok

      Maybe you forgot to mentions something important?

      check attached pbix

       


      Thank you for the attempt to solve the issue. In your file there is one thing different from mine. In my file the summarization property on the 'Year' column is set to 'Don't summarize'. 

  • FarhanAhmed's avatar
    FarhanAhmed
    Community Champion

    Drag ID from Table 1

    Drag Count of ID from Table2

    Drag Year from Table2

     

    At ID right click and enable show items with no data

     

    • Zyg_D's avatar
      Zyg_D
      Continued Contributor

      FarhanAhmed wrote:

      Drag ID from Table 1

      Drag Count of ID from Table2

      Drag Year from Table2

       

      At ID right click and enable show items with no data

       


      Thank you for the reply. I have followed these steps, but no success. Maybe it is because my relationship is 1:N, not 1:1, which I have mentioned in the question. 

  • Hi Zyg_D ,

     

    You will need to change the relationship between the tables to one-to-one and this will be achieved.

    This won't be achievable with any other relationship(1-n, n-1, n-n) since Power BI will be unable to recognize blank/NULL.

     

    Refer Below Image:

     

    Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query  !!!