Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
czuniga
Helper III
Helper III

Calculated Table Filters

I'm working on creating calculated table that looks like this:

 
= SUMMARIZECOLUMNS(
CustomerID[Guarantor], CustomerID[Name], FILTER(Apts, Apts[AptDate] = TODAY()),
 
"# In Family ", Calculate(COUNT(CustomerID[PatNum]), ALL(CustomerID),
 
Clearing the filter with "ALL" for "# In Family" isn't working though. How can I do this?
1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Decided to build a demo... Is this reflective of your setup?

bcdobbs_0-1639435746623.png

 

Basic Apts Data:

bcdobbs_1-1639435789620.png

Basic CustomerId Data:

bcdobbs_2-1639435828526.png

 

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

bcdobbs_3-1639435943502.png

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?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

8 REPLIES 8
bcdobbs
Community Champion
Community Champion

Decided to build a demo... Is this reflective of your setup?

bcdobbs_0-1639435746623.png

 

Basic Apts Data:

bcdobbs_1-1639435789620.png

Basic CustomerId Data:

bcdobbs_2-1639435828526.png

 

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

bcdobbs_3-1639435943502.png

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?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

This worked. Thank you!

 

bcdobbs
Community Champion
Community Champion

Can you send a screen shot of your model (the relationship between CustomerID and Apts.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

It's really sensitive data, but both CustomerID and Apts have the same CustomerID[PatNum] field and are related one to many

bcdobbs
Community Champion
Community Champion

In what way is it not working? Is the number too high or too low?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

The other columns have the filter applied and therefore the number is too low. I want the filter to apply to just the CustomerID[Guarantor], CustomerID[Name] columns and aggregate the rest without being limited to the date filter. 

bcdobbs
Community Champion
Community Champion

I think I might have to build an example for myself in morning. Can't quite picture it!


What happens if instead of ALL(CustomerId) you try ALL(Apts[AptDate]). 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

I thought that could be the solution! Unfortunately, it didn't change anything. I don't get an error message, but it's the exact same result as not having ALL(Apts[AptDate])

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.