Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
2 years ago
Solved

Variable date for datediff

Hi good morning, I'm trying to make a column where using a date selected from another table from the Report view pane.

Right now I have this:

IF(
'Total Tickets'[Request Status] IN {"Open", "Ongoing", "On hold", "Standby Provider", "On Standby User", "Postponed", "Resolved"},
IF(
'Total Tickets'[End Date] IN {BLANK()},
DATEDIFF(
'Total Tickets'[Date created],
-------------
HOUR
),
BLANK()
)
)


Where I have the dashes in the datediff is where I need to put the variable date that I can select from the report view.

If I need any more information to be able to help, I can provide it.
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Syndicate_Admin ,
    Here some steps that I want to share, you can check them if they suitable for your requirement.
    Here is my test data:
    Total tickets


    Time

    Create measure

    Datediff = 
    IF(
        SELECTEDVALUE('Total Tickets'[Request Status]) IN {"Open", "Ongoing", "On hold", "Standby Provider", "On Standby User", "Postponed", "Resolved"},
        IF(
            SELECTEDVALUE('Total Tickets'[End Date]) IN {BLANK()},
            DATEDIFF(
            SELECTEDVALUE('Total Tickets'[Date created]),
            SELECTEDVALUE('Time'[Another date]),
            HOUR
        ),
        BLANK()
        )
    )

    Final output

     

    Best regards,

    Albert He

     

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

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,
    Here some steps that I want to share, you can check them if they suitable for your requirement.
    Here is my test data:
    Total tickets


    Time

    Create measure

    Datediff = 
    IF(
        SELECTEDVALUE('Total Tickets'[Request Status]) IN {"Open", "Ongoing", "On hold", "Standby Provider", "On Standby User", "Postponed", "Resolved"},
        IF(
            SELECTEDVALUE('Total Tickets'[End Date]) IN {BLANK()},
            DATEDIFF(
            SELECTEDVALUE('Total Tickets'[Date created]),
            SELECTEDVALUE('Time'[Another date]),
            HOUR
        ),
        BLANK()
        )
    )

    Final output

     

    Best regards,

    Albert He

     

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