Forum Discussion

ryan_b_fiting's avatar
ryan_b_fiting
Post Patron
3 years ago
Solved

Calculated Column removing filter context

Hello -    I am trying to create a calculated column that will provide me the SUM of the cost based on a specific date value for the row in my table.   I have 4 main tables: Wireless_Numbers, Da...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi ryan_b_fiting ,

    Please refer to my pbix file to see if it helps you.

    Create relationships between tables.

    Create a column.

    Column =
    CALCULATE (
        SUM ( 'monthly cost'[Cost] ),
        FILTER (
            'monthly cost',
            'monthly cost'[wirelessnumber] = EARLIER ( 'Overview of Lines'[wirelessnumber] )
                && 'monthly cost'[Bill Cycle Date]
                    = EARLIER ( 'Overview of Lines'[Benchmark Cycle Date] )
        )
    )
    

    Or a measure.

    Measure_RE =
    CALCULATE (
        SUM ( 'monthly cost'[Cost] ),
        FILTER (
            ALL ( 'monthly cost' ),
            'monthly cost'[wirelessnumber]
                = SELECTEDVALUE ( 'Overview of Lines'[wirelessnumber] )
                && 'monthly cost'[Bill Cycle Date]
                    = SELECTEDVALUE ( 'Overview of Lines'[Benchmark Cycle Date] )
        )
    )
    

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.