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! Learn more

Reply
Anonymous
Not applicable

Calculate function with filters from 2 tables resulting blank

Hi guys how do you filter from 2 tables using the calculation function? 

Is the syntax below written properly?

 

Test = 

CALCULATE(SUM(IB_OB_Data[Accepted]),FILTER(ALL(Calendar_Data),Calendar_Data[Week No] = SELECTEDVALUE(Calendar_Data[Week No])-1),FILTER(IB_OB_Data,IB_OB_Data[Interaction Type] = "Outbound"))

 

 

adrianchy_0-1640672920919.png

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Do you want to get the sum of Accepted for the previous week of the selected week? If yes, I created a sample pbix file(see attachment), please check whether that is what you want. You can create a measure as below:

Test = 
VAR _selweek =
    SELECTEDVALUE ( 'Calendar_Data'[Week No] )
VAR _preweek =
    CALCULATE (
        MAX ( 'Calendar_Data'[Week No] ),
        FILTER ( ALL ( 'Calendar_Data' ), 'Calendar_Data'[Week No] = _selweek - 1 )
    )
RETURN
    CALCULATE (
        SUM ( 'IB_OB_Data'[Accepted] ),
        FILTER ( 'IB_OB_Data', WEEKNUM ( 'IB_OB_Data'[Date] ) = _preweek )
    )

yingyinr_0-1640932991240.png

If the above one is not your expected result, please provide some sample data with Text format and your expected result with backend logic and some special examples. Thank you.

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

Do you want to get the sum of Accepted for the previous week of the selected week? If yes, I created a sample pbix file(see attachment), please check whether that is what you want. You can create a measure as below:

Test = 
VAR _selweek =
    SELECTEDVALUE ( 'Calendar_Data'[Week No] )
VAR _preweek =
    CALCULATE (
        MAX ( 'Calendar_Data'[Week No] ),
        FILTER ( ALL ( 'Calendar_Data' ), 'Calendar_Data'[Week No] = _selweek - 1 )
    )
RETURN
    CALCULATE (
        SUM ( 'IB_OB_Data'[Accepted] ),
        FILTER ( 'IB_OB_Data', WEEKNUM ( 'IB_OB_Data'[Date] ) = _preweek )
    )

yingyinr_0-1640932991240.png

If the above one is not your expected result, please provide some sample data with Text format and your expected result with backend logic and some special examples. Thank you.

Best Regards

amitchandak
Super User
Super User

@Anonymous , Seem fine, check there is no filter on Interaction Type. May be Interaction Type <> "Outbound" is already in filter

 

Try this version of measure

Test =
var _max = maxx(allselected(Calendar_Data) ,Calendar_Data[Week No])
return
CALCULATE(SUM(IB_OB_Data[Accepted]),FILTER(ALL(Calendar_Data),Calendar_Data[Week No] = _max-1),FILTER(IB_OB_Data,IB_OB_Data[Interaction Type] = "Outbound"))

 

 

If this does not help

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors