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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
RichterSeb
New Member

Count in dim table filtered by start and end date

Hi,

I need help with the following issue.

 

Here is an example of the table that I have as input (round about 650 rows):

Machine WarrantyStartWarrantyEnd
A01.04.201830.03.2019
B03.05.202002.05.2022
C02.09.202101.09.2022
D19.01.202218.01.2023
E20.09.202219.09.2024

 

Now I need to know, during which time period we had, have and will have machines covered by warranty.

I'm not sure whether this works with a dim date table but I thought it could look like this:

DateCount of machines in warranty 
01.04.20181which is machine A
...  
01.01.20222which are machines B and C
02.01.20222which are machines B and C
03.01.20222which are machines B and C
...  
01.01.20232which are machines D and E
...  
20.01.20231which is machine E
...  
01.01.20250 

 

First column is just an dim date table starting 01.01.2018 and ends 01.01.2030 and the 2nd column is the column that i need as result.

At the end I like to look 12 monthes back from today and make a forecast for the coming 12 monthes.

 

I would appreciate any help that I can get.

 

Many thanks in advance.

 

Sebastian

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

Hi @RichterSeb 

You can refer to the following example.

The sample table is a date table

Create two columns in the date table

Count = var _filter=COUNTROWS(FILTER('Table',[Date]>=[WarrantyStart]&&[Date]<=[WarrantyEnd]))
return IF(_filter=BLANK(),0,_filter)

machines in warranty = var _fliter=FILTER('Table',[Date]>=[WarrantyStart]&&[Date]<=[WarrantyEnd])
return CONCATENATEX(_fliter,[Machine ],",")

vxinruzhumsft_0-1674788588799.png

 

 

Best Regards!

Yolo Zhu

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

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi @RichterSeb 

You can refer to the following example.

The sample table is a date table

Create two columns in the date table

Count = var _filter=COUNTROWS(FILTER('Table',[Date]>=[WarrantyStart]&&[Date]<=[WarrantyEnd]))
return IF(_filter=BLANK(),0,_filter)

machines in warranty = var _fliter=FILTER('Table',[Date]>=[WarrantyStart]&&[Date]<=[WarrantyEnd])
return CONCATENATEX(_fliter,[Machine ],",")

vxinruzhumsft_0-1674788588799.png

 

 

Best Regards!

Yolo Zhu

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

Awesome. Thanks a lot. It worked.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.