Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Show Nulls when attribute is selected and show values when selected in combination with other attrib

Hello,

 

how to show null when attribute is placed as single in table and to show values when placed in combination of other attributes in table.

 

for example: we have 3 columns in table stating product category, company and brand

 

so when product category or company is placed in matrix table it should be shown as null, and when placed in combination with brand(drilldown way) it should display values/data.

 

trying to create DAX using isfiltred function but not helping.

 

Thanks in advance.

 

13 Replies

  • ValtteriN's avatar
    ValtteriN
    Icon for Community Champion rankCommunity Champion

    Hi, 

    I am not sure if I understood your issues, but from what I understood you want to show nulls on "1st level" of a matrix and when you drill down you would display values?

    Like you suggested this can be achieved with ISFILTERED. Here is a fomula example:

    Matrix with Blanks on lvl 1 = IF(
    ISFILTERED('Matrix example'[Lvl 1])&&ISFILTERED('Matrix example'[Lvl 2])=FALSE(),"", //This checks if the current row is level 1 if so -> returns blank else returns the calculation below
    SUM('Matrix example'[Value])) //Sum can be replaced with measure

    End result:

    The key here is to use multiple ISFILTERED functions with true and false conditions.

    Hopefully this helps to solve your issue and if it does consider accepting this as a solution!

    • Anonymous's avatar
      Anonymous
      Not applicable

      this is what i am expecting..

       

      hope i am clear.

      • ValtteriN's avatar
        ValtteriN
        Icon for Community Champion rankCommunity Champion

        Okay, I think I got it now. Unfortunately, according to my understanding a single table and level 1 of a matrix operate the same way so it is not possible to have one showing nulls and the other showing values with the same formula. Maybe we should try a different approach? What is reason behind this measure so why do you need it?

  • Anonymous's avatar
    Anonymous
    Not applicable

    values for company, category are not correct at higher level i mean when selected as single attribute in table, but when i drill down with brand then values are correct at that level, so aggregated values are not correct, which should be avioded , and we are using this power bI dataset as source to different dasbaords unlike sql server or azure etc.., so to aviod developers use wrong info we need to hide data at upper level.

    • Anonymous's avatar
      Anonymous
      Not applicable

      type mistake, power BI dataset used as datasource like sql,azure etc..

    • ValtteriN's avatar
      ValtteriN
      Icon for Community Champion rankCommunity Champion

      In this case shouldn't a simple, 

      IF(ISFILTERED('Matrix example'[Brand]),SUM('Matrix example'[Value]),"")
      Do the trick? 
      If the information is correct when filtered via brand then this condition should ensure the validity of data.

      Example of how it looks:

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        can you share pbix with me, i tired similar method but its not working for me

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, but this not what i am expecting, measure should not be blank for prod_category/company.

       

      if prod-category/company slected individually then it show blank, in hierarchial struture it should populate the values.

      • V-lianl-msft's avatar
        V-lianl-msft
        Icon for Community Support rankCommunity Support

        Hi Anonymous ,

         

        Try this measure:

        Measure 2 = IF(ISINSCOPE('Table'[product category]),IF(ISINSCOPE('Table'[company ]),SUM('Table'[Value]),BLANK()),BLANK())

         

         


        Best Regards,
        Liang
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.