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

HASONEFILTER not working - suggestions?

I have four tables:

Table 1 - Sites, Groups (Site 1, Site 2 = Group A, etc), connected to Table 2 & Table 3

Table 2 - Maximum # for Site by day

Table 3 - Total # done for Site by day

Table 4 - Date Dimension, connected to Table 2 & Table 3

Tables.png

The data tables are by Site. I'm making a summary table by Group that counts # of days at max and over max.

GroupSummaryTable.png

I have the table completed, but I can't get the Total Line to reflect correctly for At Max/Over Max.

For Over Max, I am using:

If(HASONEFILTER(Table1[Group]),
  SumX(DateDimension,
                                     Calculate(IF(
                                                        SUM(Table3[Total])-Sum(Table2[Max])>0,
                                                        Count(DateDimension[Date]))),
Sumx(Filter(Table1,SUM(Table3[Total])-Sum(Table2[Max])>0),
          Count(DateDimension[Date])))

Instead of the 2 in yellow above, I just get a blank.. anyone willing to throw out some ideas as to why?

1 ACCEPTED SOLUTION

@Anonymous Fairly certain that should be HASONEVALUE.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@Greg_Deckler I believe I got this HASONEFILTER formula from you, any idea why it wouldn't work to count dates?

@Anonymous Fairly certain that should be HASONEVALUE.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Picture2.png

 

At Max: =
SUMX (
VALUES ( Table1[Group] ),
CALCULATE ( IF ( SUM ( Table2[Max] ) = SUM ( Table3[Total] ), 1, 0 ) )
)
 
Over Max: =
SUMX (
VALUES ( Table1[Group] ),
CALCULATE ( IF ( SUM ( Table2[Max] ) < SUM ( Table3[Total] ), 1, 0 ) )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

@Jihwan_Kim thanks for responding.

This is by individual day - every single day of the year - so that formula won't work.
The formula i have does work, for everything except for returning a total.

any other ideas?

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.