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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
rajatsharma1987
Frequent Visitor

Table1 counts getting filtered based on table2- I do not want that

Table1
aptiddateprogramcode
11/1/2023a
21/2/2023a
31/3/2023a
41/4/2023b
51/5/2023b
61/6/2023b
71/7/2023b
81/8/2023c
91/9/2023c
101/10/2023c

========================

Table2
aptiddateassigned to
11/1/2023t1
21/2/2023t2
31/3/2023t3
41/4/2023t4
51/5/2023t5

 

Above are the 2 tables example I have and the relationship is on Aptid and it is one to one and filtering is in both direction.

Now when I calculte the count of the aptids of Table1 it come out to be 5 and not 10 . how can I avaoid Table2 filtering the table 1 rows ? i am using below query :

 

CALCULATE(COUNT('Table1'[AppointmentID]),Table1[date] >= 06/01/2023,OR('query1'[programcode] = "a",'query1'[programcode] = "b"))
1 REPLY 1
123abc
Resident Rockstar
Resident Rockstar

It seems like you want to calculate the count of rows in Table1 that meet certain criteria (date and programcode) without considering any filtering from Table2. To achieve this, you should use the ALL function in DAX to remove any filters applied by Table2. Here's how you can modify your DAX formula:

 

CALCULATE(
COUNT('Table1'[AppointmentID]),
FILTER(
ALL('Table1'),
'Table1'[date] >= DATE(2023, 6, 1)
&& ('Table1'[programcode] = "a" || 'Table1'[programcode] = "b")
)
)

 

In this modified formula:

  1. We use the ALL function to remove any filters applied to Table1, including those from Table2.
  2. We use the FILTER function to apply the desired filtering criteria to Table1: date greater than or equal to 06/01/2023 and programcode equal to "a" or "b".
  3. Finally, we calculate the count of rows in the filtered Table1 using COUNT.

This should give you the count of rows in Table1 that meet your specified criteria without being affected by filters from Table2.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.