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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

passing date slicer value in calculated column

Requirement:

 

Start of Period and End of Period are based on user selection

Eg: Q3 2021 ( start of period: 1/7/2021 & End of Period 30/9/2021)

 

I have to create calculated columns as below

 

Undetermined Beginning of Period = IF( TrusteeClaimsList_Received[LeadLagReceivedDate]<> BLANK() && TrusteeClaimsList_Received[LeadLagReceivedDate]<= Start of Period

&& (ISBLANK(TrusteeClaimsList_Received[LeadLagDecisionEndDate]) || TrusteeClaimsList_Received[LeadLagDecisionEndDate]>= Start of Period)

&& (ISBLANK(TrusteeClaimsList_Received[CaseReopenDate]) || TrusteeClaimsList_Received[CaseReopenDate] <= start of period)

,1,0)

 

And

 

Age of Pending Claims = IF(TrusteeClaimsList_Received[LeadLagReceivedDate] <> BLANK()

&& ISBLANK(TrusteeClaimsList_Received[LeadLagDecisionEndDate]),

DATEDIFF(TrusteeClaimsList_Received[LeadLagReceivedDate],[End of Period],DAY),BLANK())

 

When user selects Q3 the start of period and end of period in the formulas should adjust accordingly.

 

What I did so far:

 

Filter using date slicer:

Created 2 measures,

  1. start of period = CALCULATE(MIN('Date Table'[Date]),ALLSELECTED('Date Table'))
  2. End of period = End of Period = CALCULATE(MAX('Date Table'[Date]),ALLSELECTED('Date Table'))

 

So, when user selects the Q3 the formulas should automatically take min(1/7/2021) and max(30/9/2021) of the Q3 and apply in formulas

 

But, my visuals are not filtering accordingly.

 

Please help me what should I do here?

 

7 REPLIES 7
halfglassdarkly
Responsive Resident
Responsive Resident

Try using selectedvalue(TrusteeClaimsList_Received[LeadLagReceivedDate])

 

when referring to your column names.

 

You will still need to use the measure in a visual table or other visual where it can inherit row level context from your other fields.

 

https://docs.microsoft.com/en-us/dax/best-practices/dax-selectedvalue

Anonymous
Not applicable

I tried and nothing shows,

It should take 30/9/2021 as my [End of Period] and filter accordingly, but no data shows 

 

varshakrishna08_0-1632403409066.png

 

It's not going to work on its own because it needs the context from the columns it's referencing - they need to be added to your visual table as well.

Anonymous
Not applicable

Not sure what that means ?

 

Here,[ End of Period] is a measure

[End of Period] = calculate(max('Date Table'[Date]),AllSelected('Date Table'))

 

And I am using that measure in another measure

Age = IF(SELECTEDVALUE(TrusteeClaimsList_Case[LeadLagReceivedDate]) <> BLANK()

&& ISBLANK(SELECTEDVALUE(TrusteeClaimsList_Case[LeadLagReceivedDate])),

DATEDIFF(SELECTEDVALUE(TrusteeClaimsList_Case[LeadLagReceivedDate]),[End of Period],DAY),BLANK())

 

And, in my visual page I filtered the page with my date column and  it should take max of the date selection(i.e, 30/9/2021 and filter the results.

Your Age measure still needs to be evaluated in a row level context for each value in TrusteeClaimsList_Case[LeadLagReceivedDate] (and any other fields eg Case ID from your TrusteeClaimsList_Case table that you want to report against).

 

You need to add a visual table with those fields and add your measure to that so that selectedvalue() has access to a single LeadLagRecievedDate per row to evaluate.

 

 

 

halfglassdarkly
Responsive Resident
Responsive Resident

Try creating these as measures instead of calculated columns. Calculated columns aren't going to inherit filter context from your slicers via your measures.

Anonymous
Not applicable

I cannot use column names in my measure right?

Age of Pending Claims = IF(TrusteeClaimsList_Received[LeadLagReceivedDate] <> BLANK()

&& ISBLANK(TrusteeClaimsList_Received[LeadLagDecisionEndDate]),

DATEDIFF(TrusteeClaimsList_Received[LeadLagReceivedDate],[End of Period],DAY),BLANK())

 

Can you please show me?

 

TrusteeClaimsList_Received[LeadLagReceivedDate]  this is a column from table 

How can I use this in Measure ?

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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