Forum Discussion
sureshsay3
4 years agoNew Member
Measure to fetch data from table
Hi All,
I have a table data like below
| Id | status |
| 1 | Missing |
| 1 | Yes |
| 1 | No |
| 2 | Yes |
| 2 | NO |
| 3 | Yes |
I need a dax function to calculate unique id where we do not have Missing value in status.
Result:
count= 2
measure = calculate(distinctcount(id),filter(table, Status<>"Missing") gives value of 3.
sureshsay3 Maybe:
Measure = VAR __Missing = DISTINCT(SELECTCOLUMNS(FILTER('Table',[status]="Missing"),"Id",[Id])) VAR __All = DISTINCT('Table'[Id]) VAR __Table = EXCEPT(__All,__Missing) RETURN COUNTROWS(__Table)
3 Replies
- Greg_Deckler
Community Champion
sureshsay3 Maybe:
Measure = VAR __Missing = DISTINCT(SELECTCOLUMNS(FILTER('Table',[status]="Missing"),"Id",[Id])) VAR __All = DISTINCT('Table'[Id]) VAR __Table = EXCEPT(__All,__Missing) RETURN COUNTROWS(__Table)- sureshsay3New Member
Hi Greg_Deckler ,
I am getting a value near the expected value for my report. i have to add additional filters based on another table. Will try those and hopefully it all works.
Regards,
Suresh
- PaulDBrown
Community Champion
As an alternative you could try:
distinctcount <> Missing =
VAR _Missing = CALCULATE (DISTINCTCOUNT (Table [ID]), Table [Status] = "Missing")
VAR _All = DISTINCTCOUNT(Table [ID])
RETURN
_All - _Missing