SOLVED

Count dates by calendar table

%3CLINGO-SUB%20id%3D%22lingo-sub-2583745%22%20slang%3D%22en-US%22%3ECount%20dates%20by%20calendar%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2583745%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUsing%20Excel%20365%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20hoping%20to%20find%20some%20help%20to%20find%20a%20way%20to%20count%20multiple%20date%20fields%20by%20year%20and%20month%20of%20my%20calendar%20table.%20The%20result%20I'm%20getting%20when%20in%20create%20my%20pivot%20table%20is%20the%20a%20repeated%20total%20count%20of%20the%20date%20in%20the%20that%20field%20against%20each%20month.%20The%20result%20I'm%20looking%20for%20is%20a%20pivot%20table%20with%2010%20fields%20that%20i%20can%20add%20one%20date%20slicer%20that%20will%20show%20the%20number%20of%20activities%20completed%20in%20said%20year%20and%20month.%20(I've%20only%20shown%202%20fields%20in%20the%20example%20not%20all%2010)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Tris_Beachwood_0-1627171974126.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F298198i9F2996A1EA0F1762%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Tris_Beachwood_0-1627171974126.png%22%20alt%3D%22Tris_Beachwood_0-1627171974126.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20did%20manage%20to%20get%20this%20to%20work%20by%20creating%2010%20x%20queries%26nbsp%3B%20with%20each%20query%20reducing%20the%20data%20set%20to%20just%20the%201%20column%20i%20needed%2C%20adding%20these%20to%20the%20data%20model%20and%20then%20creating%2010%20individual%20relationships%20to%20the%20calendar%20look%20up%20table.%20Not%20exactly%20the%20most%20efficient%20way.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Tris_Beachwood_1-1627173920079.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F298201iD5532BB45B44E249%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Tris_Beachwood_1-1627173920079.png%22%20alt%3D%22Tris_Beachwood_1-1627173920079.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2583745%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2584127%22%20slang%3D%22en-US%22%3ERe%3A%20Count%20dates%20by%20calendar%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2584127%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1111836%22%20target%3D%22_blank%22%3E%40Tris_Beachwood%3C%2FA%3E%26nbsp%3BDid%20you%20create%20a%20relationship%20between%20the%20Date%20in%20the%20Activity%20table%20and%20the%20Date%20in%20the%20Calendar%20table%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2584346%22%20slang%3D%22en-US%22%3ERe%3A%20Count%20dates%20by%20calendar%20table%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2584346%22%20slang%3D%22en-US%22%3EHi%3CBR%20%2F%3EYes%20I%20did%2C%20but%20I%20can%20only%20get%20the%20relationship%20with%201%20x%20field.%20All%20other%20relationship%20dates%20are%20inactive.%20So%20all%20fields%20are%20then%20filter%20by%20to%20active%20relationship.%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi All,

 

Using Excel 365,

 

I'm hoping to find some help to find a way to count multiple date fields by year and month of my calendar table. The result I'm getting when in create my pivot table is the a repeated total count of the date in the that field against each month. The result I'm looking for is a pivot table with 10 fields that i can add one date slicer that will show the number of activities completed in said year and month. (I've only shown 2 fields in the example not all 10)

 

Tris_Beachwood_0-1627171974126.png

 

I did manage to get this to work by creating 10 x queries  with each query reducing the data set to just the 1 column i needed, adding these to the data model and then creating 10 individual relationships to the calendar look up table. Not exactly the most efficient way.

 

Tris_Beachwood_1-1627173920079.png

 

 

7 Replies

@Tris_Beachwood Did you create a relationship between the Date in the Activity table and the Date in the Calendar table?

Hi
Yes I did, but I can only get the relationship with 1 x field. All other relationship dates are inactive. So all fields are then filter by to active relationship.

@Tris_Beachwood Difficult to imagine how your data tables are structured/related. Did a mock-up schedule and could replicate the wrong type of answer, simply by not setting the relationship right.

 

Can you upload the file? Replace any confidential information with fake data.

@Riny_van_Eekelen see attached.

 

When i need my calendar table to provide the count of the fields completed in the filtered year  & month. When i create the relationship as per below I just get the count of the fields completed in the same month as the active relationship.

 

Tris_Beachwood_0-1627210864735.png

 

Tris_Beachwood_1-1627210967347.png

 

 

I can achieve the outcome i want by creating lots of small data sets and then connecting them to the calendar table, i was just hoping to avoid doing this as its messy .






best response confirmed by allyreckerman (Microsoft)
Solution

@Tris_Beachwood Thanks! Very helpful.

 

You can't relate multiple Date columns in the activity table to the Date in the calendar table. I took your table as the source for a Power Query. Cleaned-up a bit and focussed only on the columns you seem to interested in. Then, the key step is to unpivot the table so that you are left with one single date column in the activity table. Then, the rest is a piece of cake.

 

See attached.

 

@Riny_van_Eekelen - I have so much to learn! Thanks heaps legend

I should have posted this question weeks ago!! lol