Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

data manuplation

hiiii i have a line graph with 3 different calculations in it which shows 3 different months JAN FEB MAR  i want to use a button if i click on april my graph should display FEB MAR and APRIL data  ...
  • v-xuding-msft's avatar
    5 years ago

    Hi Anonymous ,

     

    I think it is better to use a slicer rather than a button to change the values. Because we don't need to create 12 buttons for each month. I create a simple sample please have a try.

     

    Create a new table and use its column as slicer:

     

    Table =
    ADDCOLUMNS (
        FILTER ( VALUES ( Query1[Call Closed] ), [Call Closed] <> BLANK () ),
        "Year", YEAR ( [Call Closed] ),
        "Month", MONTH ( [Call Closed] ),
        "MonthName", FORMAT ( [Call Closed], "MMMM" )
    )
    

     

     

    Sort the "MonthName" column by "Month" column:

     

    Use MonthName column as slicer and change its orientation to horizontal:

     

    Create measures:

     

    Selected Slicer = SELECTEDVALUE('Table'[Month])
    RAW_SLA% 1 = 
    CALCULATE (
        [RAW SLA%],
        FILTER (
            Query1,
            Query1[Call Closed].[MonthNo] <= [Selected Slicer]
                && Query1[Call Closed].[MonthNo] >= [Selected Slicer] - 2
                && Query1[Call Closed].[Year] = YEAR ( TODAY () )
        )
    )
    
    M.SLA% 1 = 
    CALCULATE (
        [M.SLA%],
        FILTER (
            Query1,
            Query1[Call Closed].[MonthNo] <= [Selected Slicer]
                && Query1[Call Closed].[MonthNo] >= [Selected Slicer] - 2
                && Query1[Call Closed].[Year] = YEAR ( TODAY () )
        )
    )
    
    Count of Call Closed 1 = 
    CALCULATE (
        COUNT(Query1[Call Closed]),
        FILTER (
            Query1,
            Query1[Call Closed].[MonthNo] <= [Selected Slicer]
                && Query1[Call Closed].[MonthNo] >= [Selected Slicer] - 2
                && Query1[Call Closed].[Year] = YEAR ( TODAY () )
        )
    )