Forum Discussion
@ Help Required
- 6 years ago
Hi Anonymous
Are the [Credit] and [Debit] in the same table?
Which part is not sloved?
Best Regards
Maggie
Hi Anonymous ,
Your question is not very clear, however I believe that what you want is based on the group Name you get different results, you need to have a measure similar to this one:
Measure =
SWITCH (
TRUE ();
SELECTEDVALUE ( Table[GroupName] )
IN { "Indirect Cost"; "Direct Cost"; "Purchase" }; SUM ( Table[Debit] ) - SUM ( Table[Credit] );
SELECTEDVALUE ( Table[GroupName] )
IN { "Sales Accounts"; "Miscellaneous Income" }; SUM ( Table[Credit] ) - SUM ( Table[Debit] );
SELECTEDVALUE ( Table[GroupName] ) IN { "Stock PnL" }; CALCULATE (
SUM ( Table[Credit] ) - SUM ( Table[Debit] );
DATEADD ( Table[Date]; -1; MONTH )
)
- ( SUM ( Table[Credit] ) - SUM ( Table[Debit] ) )
)
Be aware that the calculation for the previous period I made it on a date format since I believe is better for time intelligence you should convert your [MMM_YYY] to a date format end of month for all dates.
This is a measure not a calculated column, but can be adjusted for column.
If you have any question can you please share a sample file and expected results.
Also please see this post regarding How to Get Your Question Answered Quickly (courtesy of @Greg_Deckler) and How to provide sample data in the Power BI Forum (courtesy of @ImkeF).