Forum Discussion

pbrainard's avatar
pbrainard
Icon for Helper III rankHelper III
4 years ago
Solved

Filter Date by Slicer Selection

I have a slicer for fiscal quarters... Q1 Q2 Q3 Q4

 

This calculated table helps me find the min and max dates for a compare. How do I edit this table query to be able to have the End Date determined by the quarter selected in the slicer?

 

CalcTablePHQGAD =
ADDCOLUMNS (
ADDCOLUMNS (
SUMMARIZE ( MHGAD_PHQ, MHGAD_PHQ[Client_ID], MHGAD_PHQ[Assess_Type] ),
"Start Date", CALCULATE ( MIN ( MHGAD_PHQ[Assess_Date] ) ),
"End Date", CALCULATE ( MAX ( MHGAD_PHQ[Assess_Date] ) )
),
"Start Score",
VAR _current_asset_type = MHGAD_PHQ[Assess_Type]
VAR _current_start_date = [Start Date]
RETURN
CALCULATE (
AVERAGE ( MHGAD_PHQ[Assess_Score] ),
MHGAD_PHQ[Assess_Date] = _current_start_date,
MHGAD_PHQ[Assess_Type] = _current_asset_type
),
"End Score",
VAR _current_asset_type = MHGAD_PHQ[Assess_Type]
VAR _current_end_date = [End Date]
RETURN
CALCULATE (
AVERAGE ( MHGAD_PHQ[Assess_Score] ),
MHGAD_PHQ[Assess_Date] = _current_end_date,
MHGAD_PHQ[Assess_Type] = _current_asset_type
),
    "Dates Okay",
        IF (
            [End Date] > [Start Date],
            "Yes",
            "No"
            )
)
 
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hello

     

    It is much more easier to have a Table Date with all the columns you want

    eg

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello

     

    It is much more easier to have a Table Date with all the columns you want

    eg

     

  • pbrainard 


    Calculated tables are created at the data model level, and they are used in your report canves. Any slicer you apply to the canves will not affect the calculated tables. 
    Consider creating a measure to use the selection from the slicer.  


    • pbrainard's avatar
      pbrainard
      Icon for Helper III rankHelper III

      I think that's where I'm stuck. How would I create such a measure? I'm guessing I want to incorporate the SELECTEDVALUE on this line...?

      "End Date"CALCULATE ( MAX ( MHGAD_PHQ[Assess_Date] ) )

       

      I do have the calc table connected to a calendar table and trying to have my 'End Date' be the max date of the quarter selected, so it ignores dates that are greater than the selected quarter.