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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Davebryant1
Frequent Visitor

Reporting on fields connected to 2 calendar tables

Hi all,

I have a table that contains start and end dates. I want to be able to count both collumns and display by month. The table looks like this


Table1

Start dateEnd Date
15-Jun-2224-Jun-22
14-Jul-2223-Jul-22
18-Jul-2227-Jul-22
16-Sep-2225-Sep-22
20-Oct-2229-Oct-22
10-Jun-2219-Jun-22
27-Jun-2206-Jul-22
18-Jul-2227-Jul-22
18-Jul-2227-Jul-22
26-Jul-2204-Aug-22
12-Aug-2221-Aug-22
09-Sep-2218-Sep-22
28-Sep-2207-Oct-22
03-Oct-2212-Oct-22
11-Oct-2220-Oct-22
11-Oct-2220-Oct-22
08-Jun-2217-Jun-22

 

Output requrired

 

 Start date CountEnd Date Count
Jun-2243
Jul-2255
Aug-2212
Sep-2232
Oct-2245


I have a calender table connected with table 1 but its join is based on the starte date. This means reporting start dates are fine but when trying to add the end date its not giving me accurate figures beacsue of the join. 

 

I can obviously create a new calendar table and join with the end date but im unsure of how i then get both sets of data onto the same table?

 

Thanks

1 ACCEPTED SOLUTION

Hi @Davebryant1 ,

 

Please try:

End date Count = 
var _Year = YEAR(MAX('Date'[Date]))
var _Month = MONTH(MAX('Date'[Date]))
return CALCULATE(COUNT(Table1[End Date]),FILTER(ALL('Table1'),'Table1'[property type] = "Type 1"&&YEAR([End Date])=_Year&&MONTH([End Date])=_Month))

 

Best Regards,

Jianbo Li

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

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Davebryant1 ,

 

Based on your description, I have created a date table:

vjianbolimsft_0-1667440379122.png

Then create the measures:

 

Start date Count = 
var _Year = YEAR(MAX('Date'[Date]))
var _Month = MONTH(MAX('Date'[Date]))
return CALCULATE(COUNT(Table1[Start date]),FILTER(ALL('Table1'),YEAR([Start date])=_Year&&MONTH([Start date])=_Month))

End date Count = 
var _Year = YEAR(MAX('Date'[Date]))
var _Month = MONTH(MAX('Date'[Date]))
return CALCULATE(COUNT(Table1[End Date]),FILTER(ALL('Table1'),YEAR([End Date])=_Year&&MONTH([End Date])=_Month))

 

Final output:

vjianbolimsft_1-1667440436339.png

Best Regards,

Jianbo Li

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

Hi Jianbo,

 

Thanks for your response, it worked perfectly.

 

How would i go about adding an additional filter onto the end date measure?

 

I want the same measure you'd already written but i want it to filter on an additional field in Table 1 too. I.e. 

Table1[property type] = "Type 1"

Many Thanks

Hi @Davebryant1 ,

 

Please try:

End date Count = 
var _Year = YEAR(MAX('Date'[Date]))
var _Month = MONTH(MAX('Date'[Date]))
return CALCULATE(COUNT(Table1[End Date]),FILTER(ALL('Table1'),'Table1'[property type] = "Type 1"&&YEAR([End Date])=_Year&&MONTH([End Date])=_Month))

 

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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