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
Asa94
Helper I
Helper I

Measure with CALCULATE, USERELATIONSHIP and FILTER for Time Comparisons

Hi all,

 

I hope you are all well,

 

I'm using a measure to count the amount of Part Numbers that were ordered after the respective Customer's Cut Off time.

 

Asa94_0-1653644830935.png

Some context:

1. The table where the customer orders are stored is a Fact Table which contains the transactional data for each order with a time stamp.

2. The table with the Customer Cut off time is a Dimension Table which contains the Cut Off times per customer.

 

I have done some research with the CALCULATE function for the measure with the USERELATIONSHIP and FILTER. 

 

I seem to stumble at the FILTER function for when I need to compare the times between the 2 tables. Any help or suggestions on what I can do with regards to that?

 

It would be be greatly appreciated 🙂 I have attached the sample file with the Raw Data and sample output.

https://we.tl/t-f9Uv7KOqMG 

 

Kind Regards,

Asa

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Asa94 ;

Sorry for my late reply. I'm not sure WHAT you mean. It would be nice to share the updated sample data and output


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @Asa94 ;

You could create a flag measure.

flag =
 var _CutOff=CALCULATE(MAX('cut off'[ZEO Cut Off]),FILTER('cut off',[Dealer Code]=MAX('Table'[Dealer Code])))
return IF( DATEDIFF(MAX('Table'[Time]),_CutOff,MINUTE)<=0,1,0)

Then apply it into table's filter.

vyalanwumsft_0-1653877431075.png

The final show:

vyalanwumsft_1-1653877446763.png

 


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yalanwu-msft ,

 

Apologies for the late reply, have been testing the solution. 

 

With the flag, it gives me the correct answer, but what it does is gives all the part numbers for every customer even though there is a filter for a single customer as seen in the picture.

 

Asa94_0-1654155758014.png

Kind Regards,

Asa

 

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.