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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jd8766
Helper II
Helper II

dynamic "next date" selection?

Hi, I have a data table that looks like the below.. I have the sold date linked to a calendar table and put into a slicer. I want to be able to select a date range in the slicer and the visual will only bring back the FIRST sold date for that company key (there are many company keys, I have just used one as an example)

jd8766_0-1661249128676.png


So if I set my date range to 01 jan 2022 to 31 dec 2022 it would show me only contractkey 12


If I set the slicer 1 aug 2022 to 31 dec 2022 it would show me only contract key 13.. and so on.

Can anyone recommend if this is achievable and how to do in PBI? 

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @jd8766 ,

Please refer to my pbix file to see if it helps you. 

Create a calendar date first.

datetable = CALENDAR(DATE(2022,1,1),DATE(2022,12,31))

Then create relationships between the tables.

vpollymsft_0-1661492378988.png

Finally create a measure.

Measure =
CALCULATE (
    MIN ( 'Table'[sold date] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[companykey] = SELECTEDVALUE ( 'Table'[companykey] )
    )
)

vpollymsft_2-1661492460697.png

 

If I have misunderstand your meaning, please provide more details.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-rongtiep-msft
Community Support
Community Support

Hi @jd8766 ,

Please refer to my pbix file to see if it helps you. 

Create a calendar date first.

datetable = CALENDAR(DATE(2022,1,1),DATE(2022,12,31))

Then create relationships between the tables.

vpollymsft_0-1661492378988.png

Finally create a measure.

Measure =
CALCULATE (
    MIN ( 'Table'[sold date] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[companykey] = SELECTEDVALUE ( 'Table'[companykey] )
    )
)

vpollymsft_2-1661492460697.png

 

If I have misunderstand your meaning, please provide more details.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@jd8766 , I think you need two measures like

 

Last Qty = Var _max = minx(filter( ALLSELECTED(Data1), Data1[ComponentKey] = max(Data1[ComponentKey]) ),Data1[soldDate])
return
CALCULATE(sum(Data1[Sold Amount]), filter( (Data1), Data1[ComponentKey] = max(Data1[ComponentKey]) && Data1[soldDate] =_max))


Sum Last Qty = sumx(VALUES(Data1[ComponentKey]) , [Last Qty])

 

 

refer the blog, you need first date

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.