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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Qotsa
Helper V
Helper V

Sum using filter Weeknum

Hi,

 

Trying to Sum [Charged_Hrs] if [StartDate] [Weeks]. 

 

[Weeks] uses Weeknum -> Weeks = WEEKNUM(vw_ShowChargesAndPayForVisits[iDate],2)

 

Act NewC = CALCULATE(SUM(vw_ShowChargesAndPayForVisits[Charged_Hrs]),WEEKNUM(ClientsList[StartDate] = vw_ShowChargesAndPayForVisits[Weeks]))
 
Error is The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Qotsa,

 

You can try to add calculated column to 'client list' table if it works for your requirement:

Act NewC =
CALCULATE (
SUM ( vw_ShowChargesAndPayForVisits[Charged_Hrs] ),
FILTER (
ALLSELECTED ( vw_ShowChargesAndPayForVisits ),
vw_ShowChargesAndPayForVisits[Weeks]
= WEEKNUM ( EARLIER ( ClientsList[StartDate] ), 2 )
&& vw_ShowChargesAndPayForVisits[ClientRef] = EARLIER ( ClientsList[ClientRef] )
)
)

Regards,
Xiaoxin Sheng

View solution in original post

5 REPLIES 5
tex628
Community Champion
Community Champion

Act NewC = CALCULATE(SUM(vw_ShowChargesAndPayForVisits[Charged_Hrs]), vw_ShowChargesAndPayForVisits[Weeks] = WEEKNUM(ClientsList[StartDate],2))

Try this.


Connect on LinkedIn
Greg_Deckler
Community Champion
Community Champion

Tough to decipher what is going on here without sample data and understanding table relationships. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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...

Sorry @Greg_Deckler,

 

My mistake. They're in 2 seperate tables.

 

This is their relationship.

 

dgdg.jpg

 

 

Anonymous
Not applicable

HI @Qotsa,

 

You can try to add calculated column to 'client list' table if it works for your requirement:

Act NewC =
CALCULATE (
SUM ( vw_ShowChargesAndPayForVisits[Charged_Hrs] ),
FILTER (
ALLSELECTED ( vw_ShowChargesAndPayForVisits ),
vw_ShowChargesAndPayForVisits[Weeks]
= WEEKNUM ( EARLIER ( ClientsList[StartDate] ), 2 )
&& vw_ShowChargesAndPayForVisits[ClientRef] = EARLIER ( ClientsList[ClientRef] )
)
)

Regards,
Xiaoxin Sheng

Hi @Greg_Deckler,

 

All in the same SQL table. Not sure how to provide sample data?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.