Forum Discussion

Shane12311's avatar
Shane12311
Regular Visitor
2 years ago
Solved

How to count the value in VALUES()

I have a formula like this:

TEST1 =
VAR VAR1 =
    CALCULATE(
        VALUES('TABLE1'[V1]),
        FILTER(
            'TABLE1',
            'TABLE1'[V2] = 'TABLE2'[V2]
        )
    )

And for VAR1, some rows it returns one value and some row return more than one value, how can I count the number of values in VAR1?
  • Short answer: as VALUES(tablename[columnname]) gives you a single column table of distinct values, you can use either COUNTROWS(VALUES(tablename[columnname])) or DISTINCTCOUNT(tablename[columnname])

    I wonder what the bigger picture is here, like I wonder if that filter will work.

1 Reply

  • sjoerdvn's avatar
    sjoerdvn
    Icon for Solution Sage rankSolution Sage

    Short answer: as VALUES(tablename[columnname]) gives you a single column table of distinct values, you can use either COUNTROWS(VALUES(tablename[columnname])) or DISTINCTCOUNT(tablename[columnname])

    I wonder what the bigger picture is here, like I wonder if that filter will work.