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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Count on Graph for values WithIn Dates

Hi ,

Was wondering of you could help... i am very new to BI (as you will see) but thought i would ask.

 

I am trying to reflect the Count of the PersonID per month between Start and End Date.

The key being that it only counts the PeDistinct Person Code of the date shown on the Graph is within the Start and End Dates.

So if a Person Code is Between March and September  2017 - it will be counted once for each month.


TIA

Person CodeStart DateEnd Date
103/12/201815/02/2019
203/12/201815/02/2019
303/12/201815/02/2019
403/12/201815/02/2019
107/08/201701/12/2017
207/08/201701/12/2017
307/08/201701/12/2017
407/08/201723/03/2018
115/05/201715/11/2018
215/05/201719/06/2017
315/05/201715/11/2018
409/05/201710/05/2017




 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

 

You can't direct use these date column to achieve your requirement, please take a look at following link to know how to create a detail data table to store expand date range and use it to direct calculate with records in date range.

 

Reference link:

Spread revenue across period based on start and end date, slice and dase this using different dates

 

Sample table formula:

Detail person records =
VAR _calendar =
    CALENDAR ( MIN ( Table[Start Date] ), MAX ( Table[End Date] ) )
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( Table, _calendar ),
            Table[Start Date] <= [Date]
                && Table[End Date] >= [Date]
        ),
        "Person Code", [Person Code],
        "Date", [Date]
    )

Notice: please don't forget to create relationship between new table and original table based on 'person code'.

 

Regards,
Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous,

 

You can't direct use these date column to achieve your requirement, please take a look at following link to know how to create a detail data table to store expand date range and use it to direct calculate with records in date range.

 

Reference link:

Spread revenue across period based on start and end date, slice and dase this using different dates

 

Sample table formula:

Detail person records =
VAR _calendar =
    CALENDAR ( MIN ( Table[Start Date] ), MAX ( Table[End Date] ) )
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( Table, _calendar ),
            Table[Start Date] <= [Date]
                && Table[End Date] >= [Date]
        ),
        "Person Code", [Person Code],
        "Date", [Date]
    )

Notice: please don't forget to create relationship between new table and original table based on 'person code'.

 

Regards,
Xiaoxin Sheng

Hi there,

 

I was browsing on the internet and this is exactly what I needed, thank you. Now I would like to modify this for records that have an empty 'End Date', which I want to interpret as still active and therefore I would like to include them in a count. How would you do this?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.