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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
RedBe
Frequent Visitor

Grouping and charting data from a measure

Hello, 

Ultimately I am trying to filter my measure I have created for days of stock. the measure I used is a simple one 

days of Stock = DATEDIFF( DATE(2022,07,29), 'Weekly usage schedule'[Date out of Stock], DAY).

It's a measure from another created for an out of stock date. 

 

The measure gives me the data I need, but what I want to do with it is to now group it up into certain categories and display it e.g, 0-30 days, 30-90days, etc.

RedBe_0-1659523616857.png

 

Is it possible to create a column somehow with this same formula? When I try it it isn't giving me the correct values. 

 

Can anyone help me map out how to go about this.   

 

 

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

Hi, @RedBe ;

Try it.

group = 
var _daysStock =
DATEDIFF (
    DATE ( 2022, 07, 29 ),
    'Weekly usage schedule'[Date out of Stock],
    DAY)
return IF(_daysStock>=0&&_daysStock<30,"0-30 days",IF(_daysStock>=30&&_daysStock<90,"30-90days",IF(_daysStock>=90,"> 90days")))

The final show:

vyalanwumsft_0-1659941296542.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.

View solution in original post

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @RedBe ;

Try it.

group = 
var _daysStock =
DATEDIFF (
    DATE ( 2022, 07, 29 ),
    'Weekly usage schedule'[Date out of Stock],
    DAY)
return IF(_daysStock>=0&&_daysStock<30,"0-30 days",IF(_daysStock>=30&&_daysStock<90,"30-90days",IF(_daysStock>=90,"> 90days")))

The final show:

vyalanwumsft_0-1659941296542.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.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors