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

Determining frequency of least profitable products for poor performing projects

Hello All,

 

I have the following table of data where I am interested in determining for frequency/count of products that yield negative gross margin for projects whose overall gross margin are less than 20%. 

Project nameProduct ListRevenueGross MarginGM%
Project 1Product 110000400040%
Project 1Product 2250-1000-400%
Project 1Product 3400-2000-500%
Project 2Product 15000100020%
Project 2Product 2400-200-50%
Project 2Product 3100-500-500%
Project 2Product 41200-2500-208%
Project 3Product 120000800040%
Project 3Product 215000700047%

 

I've created a measure to determine the GM% for each project, however I'm not sure how I can target these specific projects and display those products with negative GM. In the table above, Projects 1 and 2 would meet the <20% GM criteria and in either a pie chart visual or table visual Products 2, 3, and 4 would yeild counts of 2, 2, and 1, respectively. 

 

Thank you for any support you can offer.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @geotech 

Create measures

Capture14.JPG

Measure GM % =
CALCULATE (
    SUM ( 'Table'[Gross Margin] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Project name] = MAX ( 'Table'[Project name] )
            && 'Table'[Product List] = MAX ( 'Table'[Product List] )
    )
)
    / CALCULATE (
        SUM ( 'Table'[Revenue] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Project name] = MAX ( 'Table'[Project name] )
                && 'Table'[Product List] = MAX ( 'Table'[Product List] )
        )
    )

SUM GM = SUMX(FILTER(ALLSELECTED('Table'),'Table'[Project name]=MAX('Table'[Project name])),[Measure GM %])

negative =
CALCULATE (
    COUNT ( 'Table'[Product List] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Project name] = MAX ( 'Table'[Project name] )
            && 'Table'[Product List] = MAX ( 'Table'[Product List] )
            && 'Table'[Measure GM %] < 0
    )
)


Counts =
CALCULATE (
    COUNT ( 'Table'[Product List] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[SUM GM] < 0.2
            && 'Table'[Product List] = MAX ( 'Table'[Product List] )
            && [negative] <> BLANK ()
    )
)

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

View solution in original post

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @geotech 

Create measures

Capture14.JPG

Measure GM % =
CALCULATE (
    SUM ( 'Table'[Gross Margin] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Project name] = MAX ( 'Table'[Project name] )
            && 'Table'[Product List] = MAX ( 'Table'[Product List] )
    )
)
    / CALCULATE (
        SUM ( 'Table'[Revenue] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Project name] = MAX ( 'Table'[Project name] )
                && 'Table'[Product List] = MAX ( 'Table'[Product List] )
        )
    )

SUM GM = SUMX(FILTER(ALLSELECTED('Table'),'Table'[Project name]=MAX('Table'[Project name])),[Measure GM %])

negative =
CALCULATE (
    COUNT ( 'Table'[Product List] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[Project name] = MAX ( 'Table'[Project name] )
            && 'Table'[Product List] = MAX ( 'Table'[Product List] )
            && 'Table'[Measure GM %] < 0
    )
)


Counts =
CALCULATE (
    COUNT ( 'Table'[Product List] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[SUM GM] < 0.2
            && 'Table'[Product List] = MAX ( 'Table'[Product List] )
            && [negative] <> BLANK ()
    )
)

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

Ashish_Mathur
Super User
Super User

Hi,

Would a single visual like this work for you?  You may download my PBI file from here.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

You need to group data at that level and filter. Please find an example below

Total value = Calculate(
    count(data[employee ID]),
    FILTER(  
        ADDCOLUMNS( 
            SUMMARIZE(
                data,
                data[employee ID],
				"sum_exp",
				Sum( 'Date'[expense]),
                "Max_ID", max(data[employee ID])
            ),
            "Over20K",
            calculate(
                sum(data['Date'[expense]),
                filter(
                    all(data),
                    data[employee ID]= [Max_ID]  )
                )
            )
        ,[Over20K]>20000
    )
)

 

Create similar on Margin and Product, When you add that to the matrix/table , it will give such items

here over 20K should be your grouped margin

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

@amitchandak , thank you for the example. When you say "create similar on Margin and Product", do you mean to create a new measure for each, similar to the one below? Or, would I include a series of columns for Margin and Product within the ADDCOLUMNS function in the example measure? 

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.