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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
darliusk
Frequent Visitor

How to maintain customer category sales data when they change segments/silos

Hello

 

Although this may already be covered somewhere, I could not find it on my searches.

 

I have a sales dashboard which allocates customers into different segments ("silos") based on anticipated revenue sales.

 

Over the course of time, some customers may be moved into a different segment (Platinum, Distributor, Wholesale, Retail) if their sales performance changes.

 

Currently, I have set up my customer dataset to include segment information (Customer code, Customer Name, Silo(Segment), State, Country, Region), however, if I were to change the segment variable on this dataset, it will also change the historical sales data, moving it over to the new segment.

 

How do I retain a customers historical sales information in their old segment up to the date they change in the new segment?

 

I gather I will need to split out Segment into a new dataset (with Customer code as the Primary Key), and then use an IF statement in DAX (with state and end dates), but am not sure how to do it.

 

Please help me find the most simple and elegant way to do this.

 

If you think there is a better way, I am open to suggestions, so long as it does not mean a massive change to my schema.

 

Regards

 

Darliusk

1 ACCEPTED SOLUTION
TomasAndersson
Solution Sage
Solution Sage

Hi!
Yes, some variation of what you're suggesting is probably the easiest solution.

 

I made a simple model and a measure to try it out. You can see if can give you a few ideas of how to solve your problem.

Two simple tables, a dimension Customer table and a fact Silo table:

TomasAndersson_1-1675313312918.pngTomasAndersson_2-1675313333028.png

Notice that Al has two entries in Silo with different date, one in Jan and one in Feb.

 

Then a simple model with these two + a date table: 

 

TomasAndersson_0-1675313275585.png

 

And a measure to find Silo based on date:

 

Current Silo = 
if(
    ISINSCOPE(Customer[Customer]),
        CALCULATE(LOOKUPVALUE(Silo[Silo],Silo[Date],LASTDATE(Silo[Date])),
            FILTER(ALL(Dates[Date]), Dates[Date] <= max(Dates[Date])
            )
        )
)

 

Result:

TomasAndersson_4-1675313440858.pngTomasAndersson_5-1675313456378.png

 

With that you should be able to do calculations that depend on what silo a customer belongs to at a given date. Not sure if it covers all you need, but hopefully a start.

 

Good luck!

 

 

 

 

 

View solution in original post

2 REPLIES 2
darliusk
Frequent Visitor

 Thanks @TomasAndersson , this looks like a solid foundation to my question. Appreciate the assistance!

@darliusk 

TomasAndersson
Solution Sage
Solution Sage

Hi!
Yes, some variation of what you're suggesting is probably the easiest solution.

 

I made a simple model and a measure to try it out. You can see if can give you a few ideas of how to solve your problem.

Two simple tables, a dimension Customer table and a fact Silo table:

TomasAndersson_1-1675313312918.pngTomasAndersson_2-1675313333028.png

Notice that Al has two entries in Silo with different date, one in Jan and one in Feb.

 

Then a simple model with these two + a date table: 

 

TomasAndersson_0-1675313275585.png

 

And a measure to find Silo based on date:

 

Current Silo = 
if(
    ISINSCOPE(Customer[Customer]),
        CALCULATE(LOOKUPVALUE(Silo[Silo],Silo[Date],LASTDATE(Silo[Date])),
            FILTER(ALL(Dates[Date]), Dates[Date] <= max(Dates[Date])
            )
        )
)

 

Result:

TomasAndersson_4-1675313440858.pngTomasAndersson_5-1675313456378.png

 

With that you should be able to do calculations that depend on what silo a customer belongs to at a given date. Not sure if it covers all you need, but hopefully a start.

 

Good luck!

 

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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