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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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