最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powerbi - Power BI Classification change in different time period - Stack Overflow

programmeradmin1浏览0评论

I'm facing an issue in Power BI and would appreciate some help.

I have a column chart that displays the number of products sold (Y axis) in a selected month (data segmentation), by ABC classification (X axis )(A, B, or C). The user selects the month and year using two slicers (both coming from the DIM CALENDAR table).

The chart is currently showing sales correctly by classification. However, I introduced a new ABC classification starting in February 2025. So I want the chart behavior to be:

For dates filtered in before February 2025 → show sales using the old ABC classification

For dates filtered from February 2025 onward → show sales using the new ABC classification

Here’s how my model is structured:

DIM CALENDAR: Date table used in slicers

Sales: Sales data with product code and sale date

Products: Contains product code, old ABC classification, and new ABC classification

Relationships:

DIM CALENDAR is related to Sales via sale date

Sales is related to Products via product code

Each product has both an old and a new ABC classification, but the values may differ between them.

Question: How can I make my column chart dynamically switch between old and new ABC classification based on the selected month/year in the slicers?

Thanks in advance!

I tried several solutions and none of them worked. I tried gpt o3 help and it didn't work either.

I'm facing an issue in Power BI and would appreciate some help.

I have a column chart that displays the number of products sold (Y axis) in a selected month (data segmentation), by ABC classification (X axis )(A, B, or C). The user selects the month and year using two slicers (both coming from the DIM CALENDAR table).

The chart is currently showing sales correctly by classification. However, I introduced a new ABC classification starting in February 2025. So I want the chart behavior to be:

For dates filtered in before February 2025 → show sales using the old ABC classification

For dates filtered from February 2025 onward → show sales using the new ABC classification

Here’s how my model is structured:

DIM CALENDAR: Date table used in slicers

Sales: Sales data with product code and sale date

Products: Contains product code, old ABC classification, and new ABC classification

Relationships:

DIM CALENDAR is related to Sales via sale date

Sales is related to Products via product code

Each product has both an old and a new ABC classification, but the values may differ between them.

Question: How can I make my column chart dynamically switch between old and new ABC classification based on the selected month/year in the slicers?

Thanks in advance!

I tried several solutions and none of them worked. I tried gpt o3 help and it didn't work either.

Share Improve this question asked Mar 31 at 18:42 Daniel AcetiDaniel Aceti 111 silver badge1 bronze badge New contributor Daniel Aceti is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 1
  • could you pls provide some sample data and expected output? – Ryan Commented Apr 3 at 5:07
Add a comment  | 

1 Answer 1

Reset to default 1

Did you try something like this:

Sales_By_Dynamic_ABC = 
VAR SelectedDate = MAX('DIM CALENDAR'[Date])
RETURN 
    CALCULATE(
        SUM(Sales[Quantity]),
        FILTER(
            Products,
            IF( SelectedDate < DATE(2025,2,1), 
                Products[Old ABC Classification] IN VALUES(Products[Old ABC Classification]), 
                Products[New ABC Classification] IN VALUES(Products[New ABC Classification])
            )
        )
    )

A more complex way:

  • create a separate table with the ABC classes but not connected, to be used as the x-axis
  • sales measure based on old ABC column aligned to above table
  • sales measure based on new ABC column aligned to above table
  • dynamic measure to pick either of these sales measures depending on the selected date is before cut-off date
发布评论

评论列表(0)

  1. 暂无评论