cancel
Showing results 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

Frequent Visitor

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

 Table1 aptid date programcode 1 1/1/2023 a 2 1/2/2023 a 3 1/3/2023 a 4 1/4/2023 b 5 1/5/2023 b 6 1/6/2023 b 7 1/7/2023 b 8 1/8/2023 c 9 1/9/2023 c 10 1/10/2023 c

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

 Table2 aptid date assigned to 1 1/1/2023 t1 2 1/2/2023 t2 3 1/3/2023 t3 4 1/4/2023 t4 5 1/5/2023 t5

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"))
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.

Announcements

#### 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.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

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

Top Solution Authors
Top Kudoed Authors