Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Want to create a button in Direct Query Mode that shows Ranges (years, months, days)

Hi everyone,   I used the below formula to create a table (which isn't neccesarily required) in Import mode, the need was for a button that shows the Range (years months days) for the period - see ...
  • amitchandak's avatar
    3 years ago

    Anonymous , Try like

     

    Ranges =
    VAR StartDate = MIN ('Run Time'[StartTime])
    VAR EndDate = MAX ('Run Time'[EndTime])
    RETURN
    ConcatenateX({
    ("Number of Years", DATEDIFF(StartDate, EndDate, YEAR)),
    ("Number of Quarters", DATEDIFF(StartDate, EndDate, QUARTER)),
    ("Number of Months", DATEDIFF(StartDate, EndDate, MONTH)),
    ("Number of Days", DATEDIFF(StartDate, EndDate, DAY))
    }, [Value], ", ")