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
Anonymous
Not applicable

Filters withing Variables

Im trying to create a 1 Year IRR function. To do this I need an initial value. Below is my attempts at starting to calculate this value. I want to sum together all the values in the Multiple column up until the 1 Year (Adjusted) where the transaction type is equal to "Call" but I want this values to only be present when the date is the same as the 1 Year (Adjusted) date. Bellow is my attempt at doing this. In the first variable, I've summed up the Multiple column when the dates are what you want and the transaction type is Call. In the second variable I've then told power BI to output this result when the date is the same as 1 Year (Adjusted). But the CallMultipleValue is coming out blank. Just wondering if anyone knows what I've done wrong

 

VAR CallSumofMultiple =CALCULATE(CALCULATE(SUM(Transactions[Multiple]),FILTER(Transactions,Transactions[TransactionType]="Call"),FILTER(ALL('Calendar'),'Calendar'[Date]<=[1 Year (Adjusted)])))
VAR CallMultipleValue =IF([1 Year (Adjusted)]=[Max Calendar PME Date],CallSumofMultiple,BLANK())
RETURN
CallMultipleValue

 

 

When I don't include the TransactionType filter in the CallSumofMultiple variable the code works as expected, so not sure if there's a better way to filter the Calls

1 REPLY 1
Anonymous
Not applicable

Try this out but I don't have enough info to be sure that it'll do what you're after. You'd have to be more precise and post some screenshots of the model. The explanation of the calculation you've given is not razor-sharp.

 

[Initial Value] =
VAR __boundaryDate = [1 Year (Adjusted)]
VAR __maxCalendarPmeDate = [Max Calendar PME Date]
VAR CallSumofMultiple =
    CALCULATE (
        SUM ( Transactions[Multiple] ),
        -- Depending on what you want, you can try to remove
        -- KEEPFILTERS leaving only the statement it surrounds
        -- and see what you get. You should read about KEEPFILTERS
        -- if you haven't yet and how it changes the way
        -- filters from different contexts interact with each
        -- other.
        KEEPFILTERS( Transactions[TransactionType] = "Call" ),
        'Calendar'[Date] <= __boundaryDate,
        ALL( 'Calendar' )
    )
VAR CallMultipleValue =
    IF (
        __boundaryDate = __maxCalendarPmeDate,
        CallSumofMultiple
    )
RETURN
    CallMultipleValue

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.