Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowGet certified as a Fabric Data Engineer: Check your eligibility for a 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700. Get started
Hi
I have a table Visits with Customer ID (Customer ID FK] and multiple customer visits with visit date (Start Date).
This measure works beautifully when there is no date slicer on the report. It brings number of days between customer's first visit date and today.
Now, I would like the users to have an option to select a date instead of using Today. I want to calculate first visit's date against selected date on the slicer.
This measure works but it always brings the value of 1 because min(Visits[Start Date) is taken from the slicer. So, there is just one day difference (or 0 depending on date format) between min date and selected date.
CustomerRelationship = SUMMARIZE(Visits,Visits[Customer ID FK], "Relationship",CALCULATE(DATEDIFF(min(Visits[Start Date]), SELECTEDVALUE('Date'[Month Year]),DAY)))
Any ideas? You help would be appreciated.
Thaanks amitchandak.
I applied this but the message I have now is, the expression specified in the query is not a valid table expression.
@kris_talikowski , Create a measure and use that with customer from original table
AverageX(
SUMMARIZE(Visits,Visits[Customer ID FK], "_Relationship",DATEDIFF(min(Visits[Start Date]),selectedvalue(Date[Date]),DAY)), [_Relationship])
You can use SUMX inplace of Averagex or You can use maxx(allselected(Date), Date[Date]) in place of selectedvalue(Date[Date])
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
146 | |
72 | |
63 | |
52 | |
51 |
User | Count |
---|---|
208 | |
91 | |
62 | |
59 | |
56 |