Search code examples
daxtabularssas-tabularssas-2016

DAX - check for the existance of a column in the query


Is it possible, in a DAX measure, to check if the current query contains a particular column?

For example, I have a column named "Time" - is it possible to detect if a user in a self service environment has included this in their report, from the measure?

Edit - adding example of an output

An example output would be below

+---------+---------+------+--------------+
|  Col1   |  Col2   | Col3 | ContainsCol3 |
+---------+---------+------+--------------+
| Value 1 | Value 2 |  123 | True         |
+---------+---------+------+--------------+

+---------+---------+------+--------------+
|  Col1   |  Col2   | Col4 | ContainsCol3 |
+---------+---------+------+--------------+
| Value 1 | Value 2 |  123 | False        |
+---------+---------+------+--------------+

The query containing Col3 returns true, the query that does not include col3 returns false.


Solution

  • not exactly, but you can use functions like ISCROSSFILTERED, ISFILTERED, HASONEFILTER, HASONEVALUE which might be sufficient depending on your end-goal.