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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Mlemmers
Helper I
Helper I

Number of customers over time SCD type 2

Hi,

 

I've found some number of customer SCD type 2 questions but nothing quite over time. So I want to visualize the number of customers we have over time to see how our customer base is progressing. Now I only have a customer table connected to a date table. 

 

Think of the table as something like this (below). As you can see customer 102 left us and the rest is still with us, this is what I want to show in a line graph over time. 

SKCustomerIDFromDateToDate
110003/03/202016/11/2020
210017/11/202004/03/2023
310005/03/202301/01/2999
410206/03/202006/12/2020
510207/12/202001/01/2022
610408/03/202001/01/2999
710509/03/202001/01/2999
810610/03/202001/01/2999
911011/03/202001/01/2999

 

How do I count the number of customers over time like that? Is there a way to do it without having to generate every date between the start and stopdate? 

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

My suggestion would be to create one row per month for each Customer (provided the lowest level of granularity you want to go to is the Month and not a specific date/date range).  Are you amenable to my approach?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

That's what I was afraid of. It generates a lot of rows over a total customer base. Is there really no other way to handle this or a way to be smarter about it? Partitioning the older states could be an idea but how do people handle when GDPR kicks in and you need to remove a customer's natural IDs from the CRM system? 

v-yiruan-msft
Community Support
Community Support

Hi @Mlemmers ,

You can create a measure as below to get it, please find the details in the attachment.

Number of customers =
VAR _seldate =
    SELECTEDVALUE ( 'Calendar'[Date] )
VAR _maxtodate =
    CALCULATE (
        MAX ( 'Table'[ToDate] ),
        ALLEXCEPT ( 'Table', 'Table'[CustomerID] )
    )
VAR _tab =
    SUMMARIZE (
        'Table',
        'Table'[CustomerID],
        'Table'[FromDate],
        "@todate",
            CALCULATE (
                MAX ( 'Table'[ToDate] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[CustomerID] = EARLIER ( 'Table'[CustomerID] )
                )
            )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( [CustomerID] ),
        FILTER ( _tab, [FromDate] <= _seldate && [@todate] >= _seldate )
    )

vyiruanmsft_0-1684465483805.png

Best Regards

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

This doesn't give me a line graph with number of customers over time. The goal is to see how the customer base develops over time in a quick glance from a line graph.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.