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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Removing the filters on table and then filtering it based on different table's col.

I have 3 tables as below, Table1 is connected to table2 with bidirectional filtering and Table2 is connected to Datedim.

Now , I want to count and  filter like below from table1:

Count Table1[Aptid] where Table1[Case_type] = "u" and datedim[Year] = 2023

 

Count of "u" should be 3 as in 2023 there are 3 "u".

 

I am using below query which returns count as 2 as table 2 has only 2 rows of "u"

 

table1_Case_Created_USD =
Var Year1 = if(MONTH(TODAY()) >9 ,"FY" & RIGHT(YEAR(TODAY()),2)+1,"FY" & RIGHT(YEAR(TODAY()),2))

VAR Count1 =CALCULATE(DISTINCTCOUNT(table1[CASE_ID_Primary]),table1[New_Case_type] ="USD - Unauthorized Software Detected",DateDim[year] = Year1)
RETURN
IF(ISBLANK(count1),0,Count1)

 

Table1  
aptidcase_typedate
1u10/11/2023
2u10/12/2023
3u10/13/2023
4u10/14/2024
5a10/15/2023
6a10/16/2024

 

 

Table2 
aptiddate
110/11/2023
210/12/2023
510/15/2023

 

 

datedim 
dateyear
10/11/20232023
10/12/20232023
10/13/20232023
10/14/20232024
10/15/20232023
10/16/20232023
10/16/20242024

 

4 REPLIES 4
Dangar332
Super User
Super User

hi, @Anonymous 

try below 

coun = CALCULATE(COUNT(Table1[aptid]),
                        Table1[case_type]="u",
                         ALLCROSSFILTERED(datedim),
                        TREATAS(VALUES(datedim[date]),Table1[date])
                        )
Dangar332_0-1697179305994.png

 

i am upload pbix. file refer here 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 
Anonymous
Not applicable

Hi @Danger332, I am creating a calculated field for Year till date (YTD) therefore I cannot use the filter outside the calculated field. So "datedim = Year1" should be used in the calculation.

Anonymous
Not applicable

No , I cannot change the dependencies due to other dependencies.

Dangar332
Super User
Super User

hi, @Anonymous 
is there any chance to adjust relationship bw your table?

 

if yes then make your data model like below 

Dangar332_0-1697130065377.png

 

 

it give your desired output. 

Dangar332_0-1697130698951.png

 

 

Helpful resources

Announcements
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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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