question

Jacob-8126 avatar image
0 Votes"
Jacob-8126 asked AlexeiStoyanovsky answered

Measure to return unique dates for each item by selected range

I've got a table with various Item Id's and for each item there are multiple Orders. So there's a row for each order containing an Order Created date. I'm trying to create a measure that will allow me to dynamically view the first order created date based on a date range slicer I have.

Here is some sample data. Based on the date range currently selected I'd like the highlighted values to be the dates that return for those respective items.
132862-image.png


If I would then change the date slicer to 1/1/2020 - the measure would return these highlighted dates:
132855-image.png

This would be my expected value if I had the measure included in the table:
132856-image.png


If I wasn't concerned with the Item Id's my calculation would be something like this: Calculate(Min(Table[Order Created]), Allselected(Table)).

But I'm not sure how to take the Item's in to account so my value is unique for each item. Ideally the measure would return the min value for each row that exists for that item and not just the first one.


Thanks in advance.


sql-server-analysis-services
image.png (17.0 KiB)
image.png (16.1 KiB)
image.png (27.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AlexeiStoyanovsky avatar image
0 Votes"
AlexeiStoyanovsky answered

For your sample table, you could do Calculate(Min(Table[Order Created]), Allselected(Table[Order Created])).

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.