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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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
Community Champion
Community Champion

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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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