Forum Discussion
Mapping different depending on total sum
This approach uses two mapping code columns in DimGLMapping:
Data model:
The inactive relationship is between DimGLMapping[Credit Mapping Code] and DimGLClassificationReturns[Mapping Code].
Measures:
Total Amount = SUM ( Transactions[Amount] )
GL Mapping =
VAR vDebitMapCode =
MAX ( DimGLMapping[Debit Mapping Code] )
VAR vCreditMapCode =
MAX ( DimGLMapping[Credit Mapping Code] )
VAR vDebitMapping =
CALCULATE (
MAX ( DimGLClassificationReturns[Fin Stmt Line] ),
DimGLClassificationReturns[Mapping Code] = vDebitMapCode
)
VAR vCreditMapping =
CALCULATE (
MAX ( DimGLClassificationReturns[Fin Stmt Line] ),
DimGLClassificationReturns[Mapping Code] = vCreditMapCode,
USERELATIONSHIP ( DimGLClassificationReturns[Mapping Code], DimGLMapping[Credit Mapping Code] )
)
VAR vResult =
IF ( [Total Amount] > 0, vDebitMapping, vCreditMapping )
RETURN
vResult
Note the difference in GL Mapping when the amount is positive vs. negative:
Let me know if this works in your data model. If not, please post a pic of your data model, desired result, and sample data (in a format that can be copied into Power BI).
- lekkerbek5 years agoHelper IV
Thank you so far for your help. I have implemented the debit and credit mapping, but I'm having trouble with implementing the measure. Please find attached screenshots of:1) my model
2) partial details of my relations table
3) how my balance sheet matrix is setup
- DataInsights5 years agoSuper User
Would you post your measure so I can review the DAX? Are you getting an error, or the wrong result?