Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I want to calculate this formula on Power BI:
Days = (Trade) / (Sales * VAT)
In my the same table (FCF), I have the values for the previous concepts as follows:
Concept Value Individual
Trade 35 A
Sales 12 A
VAT 0.12 A
Trade 40 B
Sales 10 B
VAT 0.15 B
So, I am using the following formulas:
Numerator = SUMX(FILTER('FCF'; 'FCF'[Concept] = "Trade"); 'FCF'[Value])
Denominator Part 1 = SUMX(FILTER('FCF'; 'FCF'[Concept] = "Sales"); 'FCF'[Value])
Denominator Part 2 = SUMX(FILTER('FCF'; 'FCF'[Concept] = "VAT"); 'FCF'[Value])
Denominator Total = [Denominator Part 1] * [Denominator Part 2]
Days = [Numerator] / [Denominator Total]
So, the formulas operate correctly when selecting just one individual. For example, selecting "A". Calculations are:
35 / (12 * 0.12) = 24.3
However, if I select two individuals such as "A" & "B", calculations are incorrect because my formulas sum each concept and them multiply.
My formulas operate (35 + 40) / ((12 + 10) * (0.12 + 0.15) = 12,62.
And, the correct should be:
(35 + 40) / ((12 * 0.12) + (10 * 0.15) = 25.51
How can I change my formulas to get the right result?
Thank you very much for your help in advance!!
Solved! Go to Solution.
Hi @Anonymous ,
As I refer previously the calculation are based on temporary tables the [Trade_Value], [Sales_Value] & [VAT_Value] are the columns of the temporary table that sum the value of the Vat, sales and Concept. To have what you need you can add the columns you want to give context to the temporary table:
Days =
SUMX (
SUMMARIZE (
FCF;
FCF[Individual];
"Trade_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Trade" )
);
[Trade_Value]
)
/ SUMX (
SUMMARIZE (
FCF;
FCF[Individual];
FCF[Division];
"Sales_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Sales" );
"VAT_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "VAT" )
);
[Sales_Value] * [VAT_Value]
)
Being the columns related with the slicers this should work correctly.
If this does not work can you share a sample file please, if information is senstitive make it trough private message.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThanks for your solution.
Hi @Anonymous ,
The SUMX operator makes the calculation row by row that is why when you are calculating the overall total you are getting the SUM of the values and multiplying by the final value.
Believe that your best option would be to unpivot the Concept column and then make your measure SUMX calculation based on the other columns:
Days =
SUM ( 'FCF (PIVOT)'[Trade] )
/ SUMX ( 'FCF (PIVOT)'; ( 'FCF (PIVOT)'[Sales] * 'FCF (PIVOT)'[VAT] ) )
If you want to keep the table has is you should redo your calculation to:
Days =
SUMX (
SUMMARIZE (
FCF;
FCF[Individual];
"Trade_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Trade" )
);
[Trade_Value]
)
/ SUMX (
SUMMARIZE (
FCF;
FCF[Individual];
"Sales_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Sales" );
"VAT_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "VAT" )
);
[Sales_Value] * [VAT_Value]
)
This will force your calculation to only get the sales vat and trade for each of the individuals.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix ,
Thanks for your wuick reply and recommendations.
Regarding the 1st option, I cannot unpivot "Concept" column as there are many other columns on my table.
Regarding the 2st option:
- I would like not to include in the formula the "Individual" selection, but with an external slider that filters every visualization in the page.
- I tried to adjust your formula eliminating the "Individual" selection but it didn´t work (see below). The problem might be that I do not really know what you refer to [Trade_Value], [Sales_Value] and [VAT_Value] measures.
Days =
SUMX (
CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Trade" )
);
[Trade_Value]
)
/ SUMX (
CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Sales" );
"VAT_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "VAT" )
);
[Sales_Value] * [VAT_Value]
)
I would very much appreciate your help on this. Thanks a lot in advance.
Regards,
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix ,
Thanks you very much for the explanation.
Giving you more conxtext, "Individual" column is related to other table where Individuals refer to different divisions. Fo example individuals "A" & "B" refer to Division 1 and "C" & "D" refer to Division 2. My original formula worked when selecting just one Individual but not a division. In my page "Individual" & "Division" are slicers.
Trying to adjust your second formula to solve my problem, could you specify which are the formulas for [Trade_Value], [Sales_Value] & [VAT_Value].
Thank you very much for your help, hope with this explanation I can get to the right formula.
Regards,
Hi @Anonymous ,
As I refer previously the calculation are based on temporary tables the [Trade_Value], [Sales_Value] & [VAT_Value] are the columns of the temporary table that sum the value of the Vat, sales and Concept. To have what you need you can add the columns you want to give context to the temporary table:
Days =
SUMX (
SUMMARIZE (
FCF;
FCF[Individual];
"Trade_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Trade" )
);
[Trade_Value]
)
/ SUMX (
SUMMARIZE (
FCF;
FCF[Individual];
FCF[Division];
"Sales_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "Sales" );
"VAT_Value"; CALCULATE ( SUM ( FCF[Value] ); FCF[Concept] = "VAT" )
);
[Sales_Value] * [VAT_Value]
)
Being the columns related with the slicers this should work correctly.
If this does not work can you share a sample file please, if information is senstitive make it trough private message.
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThank you very much @MFelix, this perfectly worked!!!
Regards,
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.