Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

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 13
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Is this the result you expect?

Vlianlmsft_0-1639377264797.png

Try to create a measure like below:

Measure = IF(ISINSCOPE('Table'[Brand]),SUM('Table'[value]))


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

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.

Hi @Anonymous ,

 

Try this measure:

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

Vlianlmsft_0-1639981699399.png

Vlianlmsft_2-1639981760869.png

 

 


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

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.

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:
ValtteriN_0-1638955269411.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

how about if i have to drilldown by company and brand?

If the data is correct only with those two drilldowns in place then,

IF(and(ISFILTERED('Matrix example'[Brand]),ISFILTERED('Matrix example'[Company])),SUM('Matrix example'[Value]),"")

Should do the trick.

Then to get this to work in a matrix you can use Brand as a column and Company as  a row:

ValtteriN_0-1638971303188.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thanks @ValtteriN i tired this, but unfortunately my client wants it to have both in columns with filtering in both directions..

 

thank you so much..

thanks,

Geetha.

Anonymous
Not applicable

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

Anonymous
Not applicable

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

ValtteriN
Super User
Super User

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:
ValtteriN_0-1638950590088.png

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!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Geethanjali_CH_0-1638952001470.png

this is what i am expecting..

 

hope i am clear.

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?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.