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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sivarajan21
Post Prodigy
Post Prodigy

Dax measure not considering the filter context and not aggregating

Hi,

 

I have the below visual and highlighted Dax is having problem:

sivarajan21_0-1733939704047.png

 

Below is Dax is giving wrong values now.:

 

noofdays = COUNTROWS(Calendar_)

 

For the below selected filters,

sivarajan21_1-1733939730383.png

noofdays dax should display 60 for month of September 2024 and 62 for month of October 2024. The total aggregate value should be 122 days.

My expected output should be like below:

sivarajan21_3-1733939853679.png

 

FYI, when I bring in DBName-Points_Id into the visual,it is giving correct values row by row but when removed it doesn't: FYR,

sivarajan21_2-1733939803492.png

 

PFA file here Portfolio Performance - v2.15 (1).pbix

 

Thanks in advance!

@marcorusso @amitchandak @Greg_Deckler @Jihwan_Kim @Ahmedx @PhilipTreacy 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sivarajan21 

 

This is because of the direction of the relationship.

The Points[DBName-Point_Id] can not affect the result of the COUNTROW(Calnedar_)(the field [DBName-Point_Id] can not filter the table Calendar_), so the output of the noofdays will always be 30 for September and 31 for October.

vzhengdxumsft_0-1733971546917.pngvzhengdxumsft_1-1733972160682.png

Please consider restructuring your model structure to ensure that Points[DBName-Point_Id] is able to filter the table Calnedar_.

Create and manage relationships in Power BI Desktop - Power BI | Microsoft Learn

 

 

Best Regards

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @sivarajan21 

 

This is because of the direction of the relationship.

The Points[DBName-Point_Id] can not affect the result of the COUNTROW(Calnedar_)(the field [DBName-Point_Id] can not filter the table Calendar_), so the output of the noofdays will always be 30 for September and 31 for October.

vzhengdxumsft_0-1733971546917.pngvzhengdxumsft_1-1733972160682.png

Please consider restructuring your model structure to ensure that Points[DBName-Point_Id] is able to filter the table Calnedar_.

Create and manage relationships in Power BI Desktop - Power BI | Microsoft Learn

 

 

Best Regards

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

Hi @Anonymous ,

 

Many thanks for the solution!

This article is also useful!

I will accept this as a solution and close this query

 

Thanks!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors