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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
kruzack
Frequent Visitor

Finding Customer Movement from 1 segment to other

Hi All,

 

I am pretty new to powerbi report development and i have got a problem to solve.

 

I have a table ordered by dates having the below 3 columns
Date, CustomerID, DPD.

Below is sample data for the same

DateCustomerIDDPD
31-May-2312340
31-May-23234530
31-May-23345635
01-Jun-2312340
01-Jun-2323450
01-Jun-23345636
26-Jun-23234556
26-Jun-233456

61

 

I am looking for a report which would show the total number of upgrade, downgrade and same status between 2 dates selected from the same table

Date selection would be done by the user through a slicer, and whatever dates are selected the data should be filtered only for those dates and then show a summary as below
for e.g. if i have 1000 accounts distirbuted as below as of from date

DPD GroupTotal Accounts From DateUpgradeSame StatusDowngradeTotal Accounts To Date
Group 0800 75050800
Group 1-301502510025150
Group 31-60505301550
Total100030880901000

 

Can you please guide me thorugh on how to acheive the desired result.

The date selection for from and to date would be from the user side.

I have daily level data for a year in the same table and any date can be selected by the user.

This is basically done to check how many accounts are upgrading and downgrading between 2 dates selected by user.

 

It would be a great help if you can guide me through a step by step process for the same.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kruzack,

For your requirement, I think you need to create a segmentation table(group, from, to) and an unconnected date table.(segmentation group used as category, date table use as source of slicer)
Then you need to create two measure formulas based on the from date and to date. They should include a variable with summarize function and use date and use id as category to aggreated DPD value and you can add a custom field to remark the group based on aggregated DPD values.
After these steps, you can simply filter and aggregate the variable table records based on correspond segmentation group and compare between two measure result to get the detail group status changes.

from Rate =
VAR _startDate =
    MIN ( 'Selector'[Date] )
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( 'Table' ), [Date] = _startDate ),
            'Table'[Date],
            'Table'[CustomerID],
            "Total DPD", SUM ( 'Table'[DPD] )
        ),
        "Group",
            MAXX (
                FILTER (
                    ALLSELECTED ( Segmentation ),
                    [From] <= [Total DPD]
                        && [To] >= [Total DPD]
                ),
                [DPD Group]
            )
    )
VAR currGroup =
    SELECTEDVALUE ( Segmentation[DPD Group] )
RETURN
    COUNTROWS ( FILTER ( summary, [Group] = currGroup ) )

To Rate =
VAR _endDate =
    MAX ( 'Selector'[Date] )
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( 'Table' ), [Date] = _endDate ),
            'Table'[Date],
            'Table'[CustomerID],
            "Total DPD", SUM ( 'Table'[DPD] )
        ),
        "Group",
            MAXX (
                FILTER (
                    ALLSELECTED ( Segmentation ),
                    [From] <= [Total DPD]
                        && [To] >= [Total DPD]
                ),
                [DPD Group]
            )
    )
VAR currGroup =
    SELECTEDVALUE ( Segmentation[DPD Group] )
RETURN
    COUNTROWS ( FILTER ( summary, [Group] = currGroup ) )

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @kruzack,

It sounds like a common multiple date fields range analysis requirement, you can take a look at the following links about start/end date analysis and dynamic segmentation if helps:

Before You Post, Read This: start, end date 

Dynamic segmentation – DAX Patterns
Regards,

Xiaoxin Sheng

Hi @Anonymous 
Thanks for replying back.

I went over the post you mentioned in the comments.

It is slightly different from the problem which I am working on.

 

I need to check the status of the same customer over 2 different dates. So if there are 1000 customer from the date selected as of Date 1 from slicer 1, the same 1000 customers i need to track to look at their status as of Date 2 from slicer 2, and then compare how many are going up / down / same status.

 

I hope this might give you more details on my problem.

 

Thanks,

Krunal

Anonymous
Not applicable

Hi @kruzack,

For your requirement, I think you need to create a segmentation table(group, from, to) and an unconnected date table.(segmentation group used as category, date table use as source of slicer)
Then you need to create two measure formulas based on the from date and to date. They should include a variable with summarize function and use date and use id as category to aggreated DPD value and you can add a custom field to remark the group based on aggregated DPD values.
After these steps, you can simply filter and aggregate the variable table records based on correspond segmentation group and compare between two measure result to get the detail group status changes.

from Rate =
VAR _startDate =
    MIN ( 'Selector'[Date] )
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( 'Table' ), [Date] = _startDate ),
            'Table'[Date],
            'Table'[CustomerID],
            "Total DPD", SUM ( 'Table'[DPD] )
        ),
        "Group",
            MAXX (
                FILTER (
                    ALLSELECTED ( Segmentation ),
                    [From] <= [Total DPD]
                        && [To] >= [Total DPD]
                ),
                [DPD Group]
            )
    )
VAR currGroup =
    SELECTEDVALUE ( Segmentation[DPD Group] )
RETURN
    COUNTROWS ( FILTER ( summary, [Group] = currGroup ) )

To Rate =
VAR _endDate =
    MAX ( 'Selector'[Date] )
VAR summary =
    ADDCOLUMNS (
        SUMMARIZE (
            FILTER ( ALLSELECTED ( 'Table' ), [Date] = _endDate ),
            'Table'[Date],
            'Table'[CustomerID],
            "Total DPD", SUM ( 'Table'[DPD] )
        ),
        "Group",
            MAXX (
                FILTER (
                    ALLSELECTED ( Segmentation ),
                    [From] <= [Total DPD]
                        && [To] >= [Total DPD]
                ),
                [DPD Group]
            )
    )
VAR currGroup =
    SELECTEDVALUE ( Segmentation[DPD Group] )
RETURN
    COUNTROWS ( FILTER ( summary, [Group] = currGroup ) )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.