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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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