Forum Discussion

jondurbridge's avatar
jondurbridge
Icon for Helper I rankHelper I
7 years ago

Apply A Slicer Directly To A Measure

Hello

 

I would like to know if I can apply a slicer directly to a measure?

I have 2 slicers which apply to a whole report, and I have 2 measures in a line graph. But I do not want the slicers to affect the other measure, and to have both lines plotted on the same graph.

 

I have a date opened, and a date completed slicers. So I would like a grpah which plots tickets opened and closed in a given time, but for tickets opened to only have that slicer applied, and tickets closed to only have that slicer.

 

Hope that makes sense

11 Replies

  • You can use selectedvalue

     

    Measure =
    VAR Slicer1 = SELECTEDVALUE(Table1[Date Opened], "something if not true")
    return
    CALCULATE([Measure], Table1[Date Opened] = Slicer1)
    • jondurbridge's avatar
      jondurbridge
      Icon for Helper I rankHelper I

      Thanks for the quick reply..

      Could you tell me how to do it for this data?

       

      Table is Query1

      ticket opened is create_time

      ticket closed is date_completed

       

      slicers are create time and date completed

       

       

      So how would I create a measure for count of Query1[date_completed] by slicer date completed?

       

      Thank you

      • hnguy71's avatar
        hnguy71
        Icon for Super User rankSuper User
        Count Completed Based On Date = 
        var DateSelected = SELECTEDVALUE(Query1[date_completed]) 
        return
        CALCULATE(COUNT(Query1[date_completed]), Query1[date_completed] = DateSelected)

        I think this is what you're asking for....
        However, you can really just do a count for date_completed and the slicer should automatically filter out for that specific date

  • Anonymous's avatar
    Anonymous
    Not applicable

    Just so it's clear, you want the first measure included on this graph to be affected by both slicers. The other measure, you want to basically be static?

    • jondurbridge's avatar
      jondurbridge
      Icon for Helper I rankHelper I
      To be clear
      I would like measure 1 filtered by slicer 1
      Measure 2 filtered by slicer

      And then plot both measures on the same line graph

      I know how to get slicers to apply to visuals, but not measures

      Thanks for the help so far
  • Hi,

     

    Share your data in a Table format which can be pasted in MS Excel.  Also, show your expected result.  Do not bother about the visual for now.  Once we can get the numbers correct, any visual can be built from it.

    • jondurbridge's avatar
      jondurbridge
      Icon for Helper I rankHelper I

      Hi,

      I dont know how to share a table which can be pasted.

      The problem I have is that tickets created and tickets completed are both dates

       

      I have date of creation and date of completion

      I would ideally like one slicer which is just DATE and anything is sliced by that date. But I do not have a DATE field, i have a 2 - create time and complete time.

       

      If i sliced for February on create time, tickets completed are sliced wrongly. It will only show my tickets completed in february THAT WERE ALSO CREATED in February. I want tickets completed in February to be independant of anything else.

      And I also want tickets created to be independant. 

       

      Can I just have a default DATE slicer?

      • hnguy71's avatar
        hnguy71
        Icon for Super User rankSuper User

        You can open in Excel and copy and pasting your data from there into here. The Rich Text field will convert it to a readable table format. Also we can create a Date table from where your slicer is used and add relationships to your other tables.