1
votes

I want to create a measure which counts the no of rows in a table visual in my dashboard. I have the below visual table which keeps changing as you change the filter, I want to create a dynamic measure which will count the no. of rows in the table every time the filter is changed. So Basically I want to count the no of states in the table each time.

I am trying to use the DISTINCTCOUNT formula with a measure already used as a filter in the table but its giving an error Code:-

No. of State=CALCULATE(DISTINCTCOUNT(Table1['State']),'measure['spend %']>0)

Error: A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

enter image description here

1
What is your expected output?mkRabbani
Total number of rows in the table that is 12 in this caseZulfikar S Khan

1 Answers

1
votes

Please try this below code for generating the measure-

No. of State = 
CALCULATE(
    DISTINCTCOUNT(Table1['State']),
    FILTER(
        Table1,
        'measure['spend %'] > 0
    )
)