Forum Discussion
Timeslot range
Hi Team,
I have two datasets TIme(Slot, FromTime, ToTime) and Sales(Customer, Sales, InsertedDate, Date, Time). Now I want to display data for Resultset as (Customer,Sales, InsertedDate, Date, Time, Slot) in powerbi. I tried to do this using lookup which was failed and also tried to create a relationship among these two datasets which again failed. Please help.
Below is the link for datasets.
https://www.dropbox.com/scl/fi/1shxnek52yptlzevy1t7p/File.xlsx?dl=0&rlkey=slqt0wn3hp2blq9d19mife04n
Regards,
Srivalli
Hi Anonymous,
Try this measure. No relationship exists between the two tables.
Slot = VAR vSalesTime = MAX ( Sales[Time] ) VAR vTable = FILTER ( 'Time', vSalesTime >= 'Time'[FromTime] && vSalesTime <= 'Time'[ToTime] ) VAR vResult = MAXX ( vTable, 'Time'[Slot] ) RETURN vResult
8 Replies
- DataInsightsSuper User
Hi Anonymous,
Try this measure. No relationship exists between the two tables.
Slot = VAR vSalesTime = MAX ( Sales[Time] ) VAR vTable = FILTER ( 'Time', vSalesTime >= 'Time'[FromTime] && vSalesTime <= 'Time'[ToTime] ) VAR vResult = MAXX ( vTable, 'Time'[Slot] ) RETURN vResult- AnonymousNot applicable
DataInsights I have created the measure, but somehow I coulnot able to see the result. I have attached my pbix file here.
https://www.dropbox.com/s/jq5arb74lpxeowm/TimeSslot.pbix?dl=0
Regards,
Srivalli- DataInsightsSuper User
Anonymous,
In Power Query, change the datatype of FromTime and ToTime to "time" (not "datetime").
- AnonymousNot applicable
DataInsights if we need to apply a slicer for slot field, will that be possible? because again we do not have relationship between the 2 datasets.
Regards,
Srivalli- DataInsightsSuper User
Anonymous,
You may want to use a calculated column in the Sales table instead of a measure, due to the requirement to filter on the slot field.