Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
pbrainard
Helper III
Helper III

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"
            )
)
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello

 

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

eg

JamesFr06_0-1653759019430.png

 

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@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.  


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.

Anonymous
Not applicable

Hello

 

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

eg

JamesFr06_0-1653759019430.png

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.