Forum Discussion

Matt22365's avatar
Matt22365
Icon for Resolver III rankResolver III
6 years ago
Solved

USERELATIONSHIP not working on many to 1

Hi all I hope someone can help I have 2 inactive relationships between: Table1 - Start Date & Table2 - Date Table1 - End Date & Table2 - Date The purpose of this is to plot values from Table1 ...
  • v-yingjl's avatar
    6 years ago

    Hi Matt22365 ,

    To calculate the accumulated value, the table in the filter should be table2 not table1:

    Running Total Start = 
    CALCULATE (
        SUM ( 'Table1'[Value] ),
        USERELATIONSHIP ( Table2[Date], 'Table1'[Start Date] ),
        FILTER (
            ALL ( 'Table2'),
            'Table2'[Date] <= MAX('Table2'[Date])
        )
    )
    
    Running Total End = 
    CALCULATE (
        SUM ( 'Table1'[Value] ),
        USERELATIONSHIP ( Table2[Date], 'Table1'[End Date] ),
        FILTER(
            ALL(Table2),
            'Table2'[Date] <= MAX('Table2'[Date])
        )
    )

    Attached the sample file that hopes to help you: USERELATIONSHIP not working on many to 1.pbix

     

    Best Regards,
    Yingjie Li

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

  • Matt22365's avatar
    Matt22365
    6 years ago

    Hi

     

    Thank you very much that worked great. I could not open your example file but the formula update worked.

     

    I has made it so the measure doesnt accumulate in a table visualisation but I can live with that, the trend line was my main priority

     

    Matt