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
Abrar786
Helper I
Helper I

Customer increase sale with Dynamic Segmentation

Abrar786_0-1684896063683.png

 


I want to categorize the "Increase Sale" column into the following categories, but the total for "Increase Sale" is not displaying correctly with the category name. If you look at the table above, Customer_no CU323143 has an Increase Sale of $155,369.31, so it should be displayed under the category of $100k-250k.

 

Abrar786_1-1684896063685.png

 

Following are my measures:

Increase Sale =

CALCULATE (

    [CY Sale] - [LY Sale],

    FILTER (

        VALUES ( invoices_details[customer_no] ),

        [CY Sale] > 0

            && [LY Sale] > 0

            && [CY Sale] > [LY Sale]

    )

)

 

WHERE

CY Sale =

CALCULATE (

    SUM ( invoices_details[sale_cad] ),

    FILTER (

        VALUES ( invoices_details[customer_no] ),

        COUNTROWS (

            FILTER (

                'category',

                invoices_details[sale_cad] >= 'category'[category min value]

                    && invoices_details[sale_cad] < 'category'[category max value]

            )

        ) > 0

    )

)

 

LY Sale =

CALCULATE([CY Sale],SAMEPERIODLASTYEAR('Calendar'[Date]))

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Abrar786 , Try like

 

Increase Sale =
Sumx (FILTER (
VALUES ( invoices_details[customer_no] ),
[CY Sale] > 0
&& [LY Sale] > 0
&& [CY Sale] > [LY Sale]
),
[CY Sale] - [LY Sale]
)

 

or

 

Sumx (FILTER (
VALUES ( invoices_details[customer_no] ),
[CY Sale] > 0
&& [LY Sale] > 0
&& [CY Sale] > [LY Sale]
),
calculate([CY Sale] - [LY Sale])
)

View solution in original post

2 REPLIES 2
Abrar786
Helper I
Helper I

Hi @amitchandak ,

With my measure 

Increase Sale =

CALCULATE (

    [CY Sale] - [LY Sale],

    FILTER (

        VALUES ( invoices_details[customer_no] ),

        [CY Sale] > 0

            && [LY Sale] > 0

            && [CY Sale] > [LY Sale]

    )

)

I am obtaining the correct result for each customer, but I am unable to place the sum of the increase in sales under the respective category name.

 

Thank you.

amitchandak
Super User
Super User

@Abrar786 , Try like

 

Increase Sale =
Sumx (FILTER (
VALUES ( invoices_details[customer_no] ),
[CY Sale] > 0
&& [LY Sale] > 0
&& [CY Sale] > [LY Sale]
),
[CY Sale] - [LY Sale]
)

 

or

 

Sumx (FILTER (
VALUES ( invoices_details[customer_no] ),
[CY Sale] > 0
&& [LY Sale] > 0
&& [CY Sale] > [LY Sale]
),
calculate([CY Sale] - [LY Sale])
)

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.

Top Solution Authors