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
Anonymous
Not applicable

% to Sales Profit and Loss in Matrix Visual

Hi, First time posting - trying to use PowerBI in my workplace but finding it difficult to learn the DAX language and logic.

 

Hoping someone can help me.

 

I've got my data set up for the General Ledger accounts and stacked the data with Actuals and Budget in along with months and stores...

 

What i am struggling to do is divide all the entries in the matrix visual by "accounting sales" to get the classic % to Sales values.

 

I've madea  simple powerbi report which shows this but unsure how to add it...

 

evans1803_0-1599142524322.png

 

evans1803_1-1599142556301.pngevans1803_2-1599142581624.png

 

I cant seem to get the matrix to return the sum of "Sales" for all values regardless of the breakdown - tried the ALL() function but i think its something to do with the fact that the Sales are linked to that table and i need them to be disconnected or something?

 

hoping someone can help...

 

if anyone can tell me how to upload a powerBI file i'll happily share the example...

 

Thanks!!

 

 

 

2 ACCEPTED SOLUTIONS

Hi @Anonymous ,

 

You can refer to the formula.

Measure = 
// the sales of "Accounting sales"
VAR x = SUMX( FILTER( ALL(Sheet1), Sheet1[Level1] = "Accounting Sales" ), [Sum sales] )
//The [Sum sales] in my model is a column.
VAR y = SUM(Sheet1[Sum sales])
RETURN
DIVIDE(
    y, x, 0
)

v-lionel-msft_0-1599446534697.png

 

If it can not solve your problem, please upload your .pbix file through OneDrive for Business.

v-lionel-msft_0-1599445609536.png

 

Best regards,
Lionel Chen

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

Hi @Anonymous ,

 

I this this is what you want, just need create a measure to realize it. The previous solution was too complicated.

 

v-lionel-msft_0-1600326239857.png

 

Best regards,
Lionel Chen

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

9 REPLIES 9
amitchandak
Super User
Super User

@Anonymous , Try Measure like

divide(calculate(sum(Table[Value]), table[GL_Code]="Sales"),sum(Table[Value]))

 

Make it a % type column

Anonymous
Not applicable

Hi Amitchandak, Thanks so much for your help so far... i'm not sure why i've not been able to get that to work so far, I tried calculate and filter() but I assume using without the filter function treats it more like a "Sumif" in excel...

 

So far i get this...

 

evans1803_0-1599149911548.png

 

Is there any way of getting the % to Accounting sales to flow down the sub cats... so COGS 1 would show 14.3% and Cogs 2 would show 5.7%?

 

Thanks again for your help - been driving me crazy!

Hi @Anonymous ,

 

You can refer to the formula.

Measure = 
// the sales of "Accounting sales"
VAR x = SUMX( FILTER( ALL(Sheet1), Sheet1[Level1] = "Accounting Sales" ), [Sum sales] )
//The [Sum sales] in my model is a column.
VAR y = SUM(Sheet1[Sum sales])
RETURN
DIVIDE(
    y, x, 0
)

v-lionel-msft_0-1599446534697.png

 

If it can not solve your problem, please upload your .pbix file through OneDrive for Business.

v-lionel-msft_0-1599445609536.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi @v-lionel-msft ,

 

thanks for the below - i'm still not able to get the result i need though, sorry.

 

thanks for the one drive - hopefully this works...

 

https://grandvision-my.sharepoint.com/:u:/r/personal/scott_evans_visionexpress_com/Documents/TEST.pb... 

 

Thanks again!

Hi @Anonymous ,

 

I can't access your link. You can directly paste the data from these two tables in the reply in the form of a table.

v-lionel-msft_0-1599558821542.png

Similar to this, it is convenient for me to copy.

Date ID
01/01/19 1
01/02/19 1
01/03/19 1
01/04/19 1
01/05/19 1
01/06/19 1
01/07/19 1
01/08/19 1
01/09/19 1
01/10/19 1
01/11/19 1

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

DateStoreGL_CodeValue
01/12/2018101Sales120
01/12/2018101Discounts-20
01/12/2018101COGs 1-15
01/12/2018101COGs 2-5
01/12/2018101Labour Cost 1-10
01/12/2018101Labour Costs 2-12
01/12/2018101Other Costs 1-35
01/12/2018101Other Costs 2-10
01/12/2019101Sales250
01/12/2019101Discounts-60
01/12/2019101COGs 1-35
01/12/2019101COGs 2-15
01/12/2019101Labour Cost 1-25
01/12/2019101Labour Costs 2-22
01/12/2019101Other Costs 1-50
01/12/2019101Other Costs 2-3
01/12/2018102Sales80
01/12/2018102Discounts-5
01/12/2018102COGs 1-10
01/12/2018102COGs 2-5
01/12/2018102Labour Cost 1-8
01/12/2018102Labour Costs 2-3
01/12/2018102Other Costs 1-15
01/12/2018102Other Costs 2-12
01/12/2019102Sales130
01/12/2019102Discounts-15
01/12/2019102COGs 1-15
01/12/2019102COGs 2-18
01/12/2019102Labour Cost 1-12
01/12/2019102Labour Costs 2-14
01/12/2019102Other Costs 1-20
01/12/2019102Other Costs 2-18

 

 

 

 

StoreName
101London
102Manchester

 

 

 

GL_CodeLevel_1Level_2
Sales1_Accounting SalesL2_Sales
Discounts1_Accounting SalesL2_Sales
COGs 12_COGsL2_COGs
COGs 22_COGsL2_COGs
Labour Cost 13_LabourL2_Labour
Labour Costs 23_LabourL2_Labour
Other Costs 14_Other CostsL2_Other Costs
Other Costs 24_Other CostsL2_Other Costs

 

 

Level_1Sort
1_Accounting Sales1
2_COGs2
3_Labour4
4_Other Costs3

 

Level_2Sort
L2_Sales1
L2_COGs2
L2_Labour3
L2_Other Costs4

 

 
 

Relationships.PNG

@v-lionel-msft  - does the above help any? sorry so new to this forum - really appreciate your help so far - thank you!!!



Hi @Anonymous ,

 

Please refer to my .pbix file.

v-lionel-msft_0-1600248680368.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-lionel-msft ,

Thanks so much - really helping - the only problem i have now is that in my real data i have 100 Stores and these are split in to regional groups or categories based on location...

when i use filters now on the store in your pbix the table doesnt change...

i essentially need everything still to filter other than the Level 1 rows...

Thanks,

S

Hi @Anonymous ,

 

I this this is what you want, just need create a measure to realize it. The previous solution was too complicated.

 

v-lionel-msft_0-1600326239857.png

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.