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
Tevon713
Helper IV
Helper IV

Measure to find count that is not in 6 months of date

Hi all.

I been searching for solution to write a measure that would count a product inventory per ID that is NOT in the last 6 months for "Last Visit".  Was able to find previous 6 months or within 6 months in the community.

 

Sample data:

ID Description Inventory Count Last Visit
2448354 TDR3 4 11/05/22
2481554 UIY1 3 10/14/22
2533754 OLD2 30 09/27/22
3052811 OLD3 120 05/24/22
6412102 ELQ1 60 03/31/22
54001925 GAD1 48 03/17/22
54023525 EXA2 2 09/07/22
54317763 FUR1 70 10/05/22
54327099 MER2 149 09/07/22
54418425 RED1 453 09/09/22
69015111 INL9 0 03/31/22
69019301 IBR2 56 02/05/22
69018821 BOS7 -30 06/09/22
1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Tevon713 ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

(2) We can create a measure. 

 

Flag =
VAR _datediff =
    DATEDIFF ( MAX ( 'Table'[Last Visit] ), TODAY (), MONTH )
RETURN
    IF ( _datediff > 6, 1, 0 )

 

(3) Then the result is as follows.

vtangjiemsft_0-1673508687635.png

 

Best Regards,

Neeko Tang

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

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @Tevon713 ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

(2) We can create a measure. 

 

Flag =
VAR _datediff =
    DATEDIFF ( MAX ( 'Table'[Last Visit] ), TODAY (), MONTH )
RETURN
    IF ( _datediff > 6, 1, 0 )

 

(3) Then the result is as follows.

vtangjiemsft_0-1673508687635.png

 

Best Regards,

Neeko Tang

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

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.