How to filter for non-blank on distinct table

I created a distinct table using Union and Distinct and want to exclude Blank category

As you see in the below chart, the Blank category shows up. I want to exclude this from my distinct table.

Thanks for your help

image

Try wrapping the Union equation into a =CALCULATETABLE() function.

Maybe something along the lines of =CALCULATETABLE(Union equation,[Marketing Assets] <> ā€œBlankā€).

Have the union as the table being calculated, and then the argument being made is that the marketing assets column cannot equal ā€œBlankā€

Thank you Zhekezhi but it gives me this error. It must be my Dax syntax.

The filter getting rid of Blanks can’t be the first argument in a CALCULATETABLE function. The first argument has to be a table. if you put the filter in the second position do you get the same error?

I get this error now. It states each table argument of ā€˜Union’ must have the same number of columns.

image

Let me upload a WIP. One second

WIP File.pbix (13.0 MB)

To get it working, it’s not ideal, but you can calculate another table by referencing the current one with:

Marketing Assets Calculate = CALCULATETABLE(ā€˜Marketing Asset TopN’,FILTER(ā€˜Marketing Asset TopN’,ā€˜Marketing Asset TopN’[Marketing Assets] <> ā€œBlankā€))
image

Let me play around to try and avoid needing two tables.

It must have been syntax, as I just got this to work in the original table:

Marketing Asset TopN =
CALCULATETABLE(UNION(
DISTINCT(ā€˜Marketing Assets’[Marketing Assets]),
DATATABLE(ā€œMarketing Assetsā€,STRING,{{ā€œOthersā€}})),FILTER(ā€˜Marketing Assets’,ā€˜Marketing Assets’[Marketing Assets] <> ā€œBlankā€)
)

Thanks Zherkezhi. It works fine.

Much appreciated.

1 Like

Can you send over the WIP file?

Thanks