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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Visual filter does not work

Hi all,

 

I am trying to write simple DAX calculation. But the visual filter does not work as expected for DAX calculations.

 

Simple DIVIDE calculation works fine, as below.

DAX Filter No Issue_2021_0208.png

 

But with the conditional DIVIDE calculation the filter added to visual does NOT work.

 
 
 

DAX Filter Issue_2021_0208.png

 

Thanks in advance for any help.

 

Best,

-Shirish

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

I have test on your sample. I think your problem should be caused by ComplianceMonth column in your visual. ComplianceMonth column in your visual should be from Compliance table. However your filter Flag comes from related table Calendar. 

So if you use ComplianceMonth column from Compliance table, the measure will show an incorrect result.

Try to use the column in Calendar table instead of the column in Compliance .

My test:

1.png

You see above table visual in red box will show incorrect results like yours.

Visuals as below which use MonthDate in Calendar table will show correct result.

You can download the pbix file from this link: File

 

Best Regards,

Rico Zhou

 

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

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

What exactly is the problem?  What result are you expecting?  Explain the business context.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks Ashish.
Here is the scenario,
I have 2 tables (Calendar Table and Compliance Table) as below and join using MonthDate,
Calendar Table as,
MonthDate Flag
1/1/2021 Y
12/1/2020 Y
11/1/2020 Y
10/1/2020 N
Compliance Table as,
MonthDate InComplianceCount TotalCount
1/1/2021 0 0
12/1/2020 4 4
11/1/2020 2 2
10/1/2020 4 4

And compliance percentage as,
% Compliance = DIVIDE(SUM(Compliance[InCompliance]),SUM(Compliance[TotalCases]))

When I create visualization (chart or table) with Flag = "Y" and Values as MonthDate, InComplianceCount, TotalCount then vislization has 3 rows of 1/1/2021, 12/1/2020, 11/1/2020.
But, with values as MonthDate, % Compliance then I see ONLY 2 rows 12/1/2020 and 11/1/2020.

Figured out missing 3rd rows as for 1/1/2021 the totalcount is "0". Tried various options with no luck.

Any help is greatly appriciated.

Thanks,
-Shirish

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks Ashish for all your help and time.

I am trying to see if we can avoid using the slicer objects. 

 

I created 2 variable as,

var ComplianceCount = CALCULATE(sum(Compliance[InComplianceCount]), KEEPFILTERS('DIM-Date'[Previous3MonthPriorYearTrendFlag]="Y"))
var TotalCount = CALCULATE(sum(Compliance[TotalCount]), KEEPFILTERS('DIM-Date'[Previous3MonthPriorYearTrendFlag]="Y"))
 
when I return "ComplianceCount" I see dates are filtered correctly as below.
DAX Filter No Issue_2021_0209.png
 
But if I add once condition as below,
var CompTest = if(TotalCount=0,1,2)
 
and return "CompTest" I see dates filter is removed and all the dates are displayed as below.
DAX Filter Issue_2021_0209.png
 
I am trying to figure out the reason.
 
Thanks,
-Shirish
Anonymous
Not applicable

Hi @Anonymous 

I have test on your sample. I think your problem should be caused by ComplianceMonth column in your visual. ComplianceMonth column in your visual should be from Compliance table. However your filter Flag comes from related table Calendar. 

So if you use ComplianceMonth column from Compliance table, the measure will show an incorrect result.

Try to use the column in Calendar table instead of the column in Compliance .

My test:

1.png

You see above table visual in red box will show incorrect results like yours.

Visuals as below which use MonthDate in Calendar table will show correct result.

You can download the pbix file from this link: File

 

Best Regards,

Rico Zhou

 

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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.