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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
DiKi-I
Post Partisan
Post Partisan

Need help with data modelling

 

Hi ,
I need help with one of the the requirement. I have a csutomer churn table with csutomer and churn status and an invoice table.
For new and returning customer there is not any issue since they fall in the same fiscal year and can be easily sliced. 
The issue is with the lost customer. If a customer is lost in 2022 then it will have revenue in 2021 and not in 2022. But the client wants to see the figures as lost revenue in 2022 and not 2021. Could you please help how i can do this in power bi.

I have attached the sample pbix file with data. Please let me know for any questions.

 

https://drive.google.com/file/d/1ZdbyUWeARhVWBV8ncd47izKbhnR5MKY-/view?usp=drive_link

 

I have to show lost /new/returning in the bar chart as legend and the revenue for the different fiscal year. If a customer is lost in 2022 , in 2022 it should should show lost revenue(2021 revenue)

2 ACCEPTED SOLUTIONS
DiKi-I
Post Partisan
Post Partisan

Anonymous
Not applicable

Hello @DiKi-I 

You can refer to the following solution.

1.Create a new table. the table has no relationship with other tables.

 

ChurnType = VALUES(CustomerChurn[Churn])

 

vxinruzhumsft_0-1733364222833.png

2.Create a measure

 

MEASURE =
SWITCH (
    SELECTEDVALUE ( 'ChurnType'[Churn] ),
    "Lost",
        VAR a =
            CALCULATETABLE (
                VALUES ( CustomerChurn[ContactID] ),
                ALLSELECTED ( CustomerChurn[ContactID] ),
                CustomerChurn[FiscalYear] = SELECTEDVALUE ( 'Date'[FiscalYear] ),
                CustomerChurn[Churn] = "Lost"
            )
        RETURN
            CALCULATE (
                SUM ( Invoice[Amount] ),
                ALL ( Invoice ),
                Invoice[ContactID] IN a,
                Invoice[FiscalYear]
                    = SELECTEDVALUE ( 'Date'[FiscalYear] ) - 1
            ),
    CALCULATE (
        SUM ( Invoice[Amount] ),
        CustomerChurn[Churn] IN VALUES ( 'ChurnType'[Churn] )
    )
)

 

3.Then create a bar chart, and put the following field to the visual.

vxinruzhumsft_1-1733364373144.png

 

Output

vxinruzhumsft_2-1733364387837.png

Best Regards!

Yolo Zhu

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

4 REPLIES 4
DiKi-I
Post Partisan
Post Partisan

Thank you so much it worked.

Anonymous
Not applicable

Hello @DiKi-I 

You can refer to the following solution.

1.Create a new table. the table has no relationship with other tables.

 

ChurnType = VALUES(CustomerChurn[Churn])

 

vxinruzhumsft_0-1733364222833.png

2.Create a measure

 

MEASURE =
SWITCH (
    SELECTEDVALUE ( 'ChurnType'[Churn] ),
    "Lost",
        VAR a =
            CALCULATETABLE (
                VALUES ( CustomerChurn[ContactID] ),
                ALLSELECTED ( CustomerChurn[ContactID] ),
                CustomerChurn[FiscalYear] = SELECTEDVALUE ( 'Date'[FiscalYear] ),
                CustomerChurn[Churn] = "Lost"
            )
        RETURN
            CALCULATE (
                SUM ( Invoice[Amount] ),
                ALL ( Invoice ),
                Invoice[ContactID] IN a,
                Invoice[FiscalYear]
                    = SELECTEDVALUE ( 'Date'[FiscalYear] ) - 1
            ),
    CALCULATE (
        SUM ( Invoice[Amount] ),
        CustomerChurn[Churn] IN VALUES ( 'ChurnType'[Churn] )
    )
)

 

3.Then create a bar chart, and put the following field to the visual.

vxinruzhumsft_1-1733364373144.png

 

Output

vxinruzhumsft_2-1733364387837.png

Best Regards!

Yolo Zhu

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

 

 

DiKi-I
Post Partisan
Post Partisan

DiKi-I
Post Partisan
Post Partisan

 @Ibendlin 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors