Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I want to calculate in the gray column, each category divided by the ventas category. (ex. divide consumo/ventas, bebidas/ventas, comestibles/ventas)
For example: divide bebidas row by the total ventas row to show the percentage of how much the bebidas row reprents of total ventas. (if bebidas is 10 and total ventas 100, it should give me 10%). IMPORTANT: VENTAS IS NOT THE BEBIDAS PARENT ROW
I want to just have a formula that applies for every row, as I know that I can get a total individual formula for each row by dividing by each row individually (see example below). But the example below just gives me what percentage of ventas is represented by bebidas in the example below, not for every row
please try
% de ventas en bebidas =
(
DIVIDE (
SUM ( ConsolidadoPG[Valor] ),
CALCULATE (
SUM ( ConsolidadoPG[Valor] ),
ConsolidadoPG[Categoria] = "Ventas",
ALL ( ConsolidadoPG[Sub Categoria] )
)
)
)
Won't work 😔. Think about it like an income statement, were ventas is sales, and I want to see how much each cost represents of sales. Doing this way I am just filtering for data that contains sales
@JonathanK1999
It should work. What results are you getting. However, you may also try
% de ventas en bebidas =
(
DIVIDE (
SUM ( ConsolidadoPG[Valor] ),
CALCULATE (
SUM ( ConsolidadoPG[Valor] ),
ConsolidadoPG[Categoria] = "Ventas",
ALL ( ConsolidadoPG )
)
)
)
Same problem happens, which is I do not get data for sub categories that don't represent the ventas row. In other words, I need to divide completely separate data points. Look at the table I created with an example of the values I need. % of sales is each row divided by the sales value. Sales and Costs are parent rows. Screen shot at the bottom is results I am getting.
Value | % of Sales | ||
Sales | $160.00 | ||
Water | $100.00 | 62.50% | |
Sushi | $10.00 | 6.25% | |
Pasta | $20.00 | 12.50% | |
Delivery | $30.00 | 18.75% | |
Costs | $76.00 | 47.50% | |
Bebidas | $50.00 | 31.25% | |
Comestibles | $3.00 | 1.88% | |
Daportare | $4.00 | 2.50% | |
Empaques | $2.00 | 1.25% | |
Evenetos | $7.00 | 4.38% | |
Paletas | $10.00 | 6.25% | |
Net | $84.00 |
I think there is a value for subcategories. But it is very small and hence rounded to zero. My guess is that you have outside slicers from the same table. Clear all filters and see what you get. If this is the case then you need to place all of these columns inside the ALLEXCEPT as follows
% de ventas en bebidas =
DIVIDE (
SUM ( ConsolidadoPG[Valor] ),
CALCULATE (
SUM ( ConsolidadoPG[Valor] ),
ConsolidadoPG[Categoria] = "Ventas",
ALLEXCEPT ( ConsolidadoPG, ConsolidadoPG[Column1], ConsolidadoPG[Column2], etc.. )
)
)
Doesn't work, I guess I'll have to create all the individual formulas. Is there a way to add different formulas all in the same column in a table?
Try this: You can acess the values of the categories via "SELECTEDVALUE"
% de ventas en bebidas =
VAR _selectcat = SELECTEDVALUE(ConsolidadoPG[Categoria])
RETURN
(DIVIDE((CALCULATE(SUM(ConsolidadoPG[Valor]), ConsolidadoPG[Sub Categoria]="Bebidas")), CALCULATE(SUM(ConsolidadoPG[Valor]), ConsolidadoPG[Categoria]=_selectcat)))
Proud to be a Super User!
that would just give me for bebidas, I need to for all of the rows
Try this, but without a better example i do not understand your calc:
% de ventas en bebidas =
VAR _selectcat = SELECTEDVALUE(ConsolidadoPG[Categoria])
VAR _selectsub = SELECTEDVALUE(ConsolidadoPG[Sub Categoria])
RETURN
(DIVIDE((CALCULATE(SUM(ConsolidadoPG[Valor]), ConsolidadoPG[Sub Categoria]=__selectsub)), CALCULATE(SUM(ConsolidadoPG[Valor]), ConsolidadoPG[Categoria]=_selectcat)))
Proud to be a Super User!
Won't work either. Think about it like an income statement, were ventas is sales, and I want to see how much each cost represents of sales. Doing this way I am just filtering for data that contains sales
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |