Forum Discussion
Anonymous
2 years agoNot applicable
How can I make calculations in a visual table for Income Statement/ P&L
Hi All, This is a visusal I have creating using GL and Account Tables Kindly let me know how can I make the calculations for missing rows. Gross profit = Revenue - Cost of Sale GP Margin = ...
- 2 years ago
Hi,
Please share your sample pbix file's link, and then I can try to look into it.
Thanks.
- 2 years ago
Hi,
I am a bit confused about the logic, but please check the below picture and the attached pbix file.
I hope you can try to amend the formula if I misunderstood the logic.
expected result measure: = VAR _revenue = CALCULATE ( [Total Actuals], 'Account Mapping'[Row Index] = 1, REMOVEFILTERS ( IsStructure ) ) VAR _cost = CALCULATE ( [Total Actuals], 'Account Mapping'[Row Index] = 2, REMOVEFILTERS ( IsStructure ) ) VAR _grossprofit = _revenue + _cost VAR _gpmargin = DIVIDE ( _grossprofit, _revenue ) VAR _otherincome = CALCULATE ( [Total Actuals], 'Account Mapping'[Row Index] = 6, REMOVEFILTERS ( IsStructure ) ) VAR _sga = CALCULATE ( [Total Actuals], 'Account Mapping'[Row Index] = 5, REMOVEFILTERS ( IsStructure ) ) VAR _ebitda = _grossprofit + _otherincome - _sga RETURN SWITCH ( SELECTEDVALUE ( IsStructure[Row Index] ), 3, _grossprofit, 4, FORMAT ( _gpmargin, "#.00%" ), 7, _ebitda, [Total Actuals] )
Jihwan_Kim
Super User
2 years agoHi, I am not sure how your datamodel looks like, but please try to write an additinoal measure something like below whether it suits your requirement.
SELECTEDVALUE function - DAX | Microsoft Learn
SWITCH function (DAX) - DAX | Microsoft Learn
expected result measure: =
SWITCH (
SELECTEDVALUE ( tablename[Description Profit & Loss Statement] ),
"Gross profit",
CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "Revenue"
)
- CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "Cost of Sale"
),
"GP Margin",
DIVIDE (
CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "Gross Profit"
),
CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "Revenue"
)
),
"EBITDA",
CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "Gross Profit"
)
+ CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "Other Income"
)
- CALCULATE (
[Total Actuals],
tablename[Description Profit & Loss Statement] = "SQ&A"
),
[Total Actuals]
)
- Anonymous2 years agoNot applicable
Hi Jihwa,
Thank you for the quick answer.
I tried the Switch function, However I'm not getting the results. Kindly advise
- Jihwan_Kim2 years ago
Super User
Hi,
Please share your sample pbix file's link, and then I can try to look into it.
Thanks.