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
Deston
Frequent Visitor

Dynamic segmentation over two dimensions

Hello community

 

Hoping someone can assist. 

 

I've a unique scenario where I am attempting to dynamically segment the price difference between two products. My model has 2 product dimensions, and this allows me to compare, in one visual, the performance of a specific product (Product Dim 1), to another product (Product Dim 2). However, this does mean that I cannot use the traditional method of a single Product table (as per https://www.daxpatterns.com/) , and so I thought to use a virtual table instead. However, I'm struggling to get this to work:

 

Price Segmentation (Dynamic) =
VAR ProductsInSegment =
    FILTER (
        CALCULATETABLE (
            // An attempt at creating a virtual table
            ADDCOLUMNS (
                SUMMARIZE ( Sales, 'Date'[Week Ending] ),
                "Price Diff", [Price Difference]
            ),
            ALLSELECTED ( 'Product' ),
            ALLSELECTED ( 'And Product' )
        ),
        VAR PercentageDifference = [Price Diff]
        VAR SegmentForProduct =
            FILTER (
                'Percentage Buckets',
                IF (
                    PercentageDifference >= 0,
                    AND (
                        PercentageDifference >= 'Percentage Buckets'[Min],
                        PercentageDifference < 'Percentage Buckets'[Max]
                    ),
                    AND (
                        PercentageDifference <= 'Percentage Buckets'[Min],
                        PercentageDifference > 'Percentage Buckets'[Max]
                    )
                )
            )
        VAR IsProductInSegments =
            NOT ISEMPTY ( SegmentForProduct )
        RETURN
            IsProductInSegments
    )
VAR Result =
    CALCULATE ( SUM ( Summarize1[Volume Diff] ), KEEPFILTERS ( ProductsInSegment ) )
RETURN
    Result

 

Please follow this link to a report that illustrates the requirement in more detail:

 

https://1drv.ms/u/s!AiMOn9aJXFVYiEuADxfKXTgHdi_7?e=bR4ehZ

 

Any help would be greatly appreciated!

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Deston - Just FYI I downloaded the file and am taking a look. Just so that I can understand in words what you are trying to do... OK, I have no idea, can you explain in words what you are trying to do? I see there are price buckets. I see that there is a volume difference. There are 2 products, do they both fall into the same price buckets or different price buckets. Are you trying to show that product 1 falls into price bucket A and has this much volume versus product 2 falls into price bucket B and has this other volume?

 

Sorry, I'm not clear on this at all. Please @ me in any reply. Thanks.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hey @Greg_Deckler 

Thank you for replying. Here's what I am trying to do. We're a FMCG distribution company; we distribute products, but we also manufacture and distribute our own branded products. The aim of the model is to bucket theprice difference between the market related product and our own brand product, so that we can compare the volume difference within each bucket. 

If you look at the 2 calculated tables, Summarize1 act as the harvesting table, where Summarize2 is where I bucket price difference to compare the volume difference. But, ideally this can all be done inside a measure so that can be fully dynamic. 

Hope this makes sense 🙂 

Hi @Deston 

 

You might consider providing your dummy pbix that would be helpful for us to investigate it further. 

You can upload it to the onedrive for business and share the link here.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hello @v-diye-msft ,

 

A model and downlink was provided in the original post, however, happy to provide it again here:

 

https://1drv.ms/u/s!AiMOn9aJXFVYiEuADxfKXTgHdi_7?e=fa71cJ

 

Please let me know if you can download the Power BI report.

 

Thank you,

Deston

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.