Forum Discussion
Switching Signs in Power BI
- 4 years ago
Hello - I recommend you add a mapping table that indicates the desired flip behavior and then relate it to the fact table and incorporate it into your calculation.
Grouping Flip Behavior A -1 B -1 C 1 D 1 - 4 years ago
Hi, hoa3nok7
In this case, I think the flipped amount column is not necessary.
You can use the ISINSCOP function to calculate the total separately.Modify the above measures as follows:
Measure = VAR _SUM_AB = CALCULATE ( SUM ( 'Table1'[Amount] ), FILTER ( 'Table1', 'Table1'[FISCAL_YEAR] = [Selected Fiscal Year] ), FILTER ( 'Table1', 'Table1'[PERIOD] <= [Selected Period] ), FILTER ( 'Table1', 'Table1'[Grouping] = "A" || 'Table1'[Grouping] = "B" ) ) VAR _SUM_CD = CALCULATE ( SUM ( 'Table1'[Amount] ), FILTER ( 'Table1', 'Table1'[FISCAL_YEAR] = [Selected Fiscal Year] ), FILTER ( 'Table1', 'Table1'[PERIOD] <= [Selected Period] ), FILTER ( 'Table1', 'Table1'[Grouping] = "C" || 'Table1'[Grouping] = "D" ) ) VAR _SUM_ALL = CALCULATE ( SUM ( 'Table1'[Amount] ), FILTER ( 'Table1', 'Table1'[FISCAL_YEAR] = [Selected Fiscal Year] ), FILTER ( 'Table1', 'Table1'[PERIOD] <= [Selected Period] ) ) RETURN IF ( ISINSCOPE ( 'Table'[Grouping] ), // 1, - ( _SUM_AB ) + _SUM_CD, // 2 - ( _SUM_ALL ) )If this doesn't work, could you please consdier sharing more details about it and posting expected result so it is clear on what needs to be implemented? And It would be great if there is a sample file without any sesentive information here. It makes it easier to give you a solution.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I can't tell how you are getting the values in the matrix you want to achieve from the data you provided.