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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
APIR
Regular Visitor

DAX calculate Previous month lost customer revenue

Hi guys,

I am having trouble calculating the previous month lost customer revenue.

My model relies on a single way relationship between thr fact table and the time table, so that is not possible to change.

I would like to display the measure "Churn_lost_$" as shown in the picture below.

Thank you very much! 🤙

 

You can donload the model here:

https://drive.google.com/file/d/1MKFmtBIm1Z-yJ0--FhVRuIrZqWVV166c/view?usp=sharing

 

Untitled.png

4 REPLIES 4
APIR
Regular Visitor

up

v-kaiyue-msft
Community Support
Community Support

Hi @APIR ,

 

Create measure.

Step1 = 
var _column=
SELECTCOLUMNS(
    FILTER(ALL('FACT_Orders'),
    'FACT_Orders'[Account Name 1]=MAX('Accounts'[Customer])),"Test",'FACT_Orders'[Date])
return
IF(
    MAX('TIME_Table'[Date]) in _column,BLANK(),0)

 

Step2 = 
COUNTX(ALL('Accounts'),'Accounts'[Customer])

 

Step3 = 
IF(
HASONEVALUE('Accounts'[Customer]) , [Step1],
 IF(
HASONEVALUE('TIME_Table'[Date].[Month]) && [Step2]<>[Accounts Distinct],0,BLANK()))

 

vkaiyuemsft_0-1719392703817.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Hello Clara,

First of all thank you for your time. Not correct though (yet!)

I've increased the data and the value are incorrect. Here is how I imagine the result:

I've tried many things but I still stuck.

Untitled.png

 

Here is the file with more data: 

https://drive.google.com/file/d/1MKFmtBIm1Z-yJ0--FhVRuIrZqWVV166c/view?usp=sharing

APIR
Regular Visitor

up

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.