Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

USERELATIONSHIP combined with a Filter

Dear PowerBI Community,

I have a problem releted to the combination of a USERELATIONSHIP formule and a Filter. 

My initial problem was that I had two differents columns dates (IFD Actual and IFD Planned) that after counting them I needed  to show in the same graph. I solved this issue thanks to the help of another user, but now i have another problem:

I would like to do have a Cumulative function and in this case:

IFD Planned has an active connection and works perfectly 

IFD Actual has an inactive relationship and if I use the same cumulative formule, it doesn't work.

without Filtering with cumulative function:

Filtering and trying to do the cumulative:

Do you have any idea on how may I show the cumulative also for IFD Actual?
Thanks in advance for your help

  • You need to do the cumulative filtering on the date table, not the model table.

     

    See if this gets you closer:

    IFD_PLANNED =
    VAR _MaxDate = MAX ( 'Date 1'[Date] )
    RETURN
        CALCULATE (
            COUNT ( 'Model 60'[IFD Planned] ),
            USERELATIONSHIP ( 'Model 60'[IFD Planned], 'Date 1'[Date] ),
            'Date 1'[Date] <= _MaxDate
        )

2 Replies

  • You need to do the cumulative filtering on the date table, not the model table.

     

    See if this gets you closer:

    IFD_PLANNED =
    VAR _MaxDate = MAX ( 'Date 1'[Date] )
    RETURN
        CALCULATE (
            COUNT ( 'Model 60'[IFD Planned] ),
            USERELATIONSHIP ( 'Model 60'[IFD Planned], 'Date 1'[Date] ),
            'Date 1'[Date] <= _MaxDate
        )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks a lot AlexisOlson . This is the correct solution. I have only to do the calculation till today as date but it works perfectly. Thanks again!!!