Forum Discussion
Calculated Table Filters
I'm working on creating calculated table that looks like this:
Decided to build a demo... Is this reflective of your setup?
Basic Apts Data:
Basic CustomerId Data:
With this setup if I create a calculated table with your code:
NewTable = SUMMARIZECOLUMNS( CustomerID[Gaurantor], CustomerID[Name], FILTER(Apts, Apts[Date] = TODAY()), "# In Family ", CALCULATE( COUNT(CustomerID[PatNum]), ALL(CustomerId) ) )It gives back
which is a count of every row in the CustomerId table.
I wondered if you have a bidirectional relationship in your model? As if I switch it to that I get only count for that day.
Also are you definently wanting to count the number of id's in CustomerId summarised by Gauarntor and Name? Won't that always be 1? Do you actually want the number of related Ids in the Apt table with the date filter removed? In which case:
NewTable = SUMMARIZECOLUMNS( CustomerID[Gaurantor], CustomerID[Name], FILTER(Apts, Apts[Date] = TODAY()), "# In Family ", CALCULATE( COUNT(Apts[PatNum]), REMOVEFILTERS( Apts[Date] ) ) )If I'm totally missing the point can you illustrate with a very simple demo pbix file or download and modify Sample File and mock up expected output in excel?
8 Replies
- bcdobbsCommunity Champion
Can you send a screen shot of your model (the relationship between CustomerID and Apts.
- bcdobbsCommunity Champion
Decided to build a demo... Is this reflective of your setup?
Basic Apts Data:
Basic CustomerId Data:
With this setup if I create a calculated table with your code:
NewTable = SUMMARIZECOLUMNS( CustomerID[Gaurantor], CustomerID[Name], FILTER(Apts, Apts[Date] = TODAY()), "# In Family ", CALCULATE( COUNT(CustomerID[PatNum]), ALL(CustomerId) ) )It gives back
which is a count of every row in the CustomerId table.
I wondered if you have a bidirectional relationship in your model? As if I switch it to that I get only count for that day.
Also are you definently wanting to count the number of id's in CustomerId summarised by Gauarntor and Name? Won't that always be 1? Do you actually want the number of related Ids in the Apt table with the date filter removed? In which case:
NewTable = SUMMARIZECOLUMNS( CustomerID[Gaurantor], CustomerID[Name], FILTER(Apts, Apts[Date] = TODAY()), "# In Family ", CALCULATE( COUNT(Apts[PatNum]), REMOVEFILTERS( Apts[Date] ) ) )If I'm totally missing the point can you illustrate with a very simple demo pbix file or download and modify Sample File and mock up expected output in excel?
- czunigaHelper III
This worked. Thank you!