Forum Discussion
Dax Measure
- Anonymous3 years ago
HI NishPatel,
You can try to use the following measure formula if it suitable for your requirement:
VarianceMeasure = VAR currDate = MAX ( DebitTable[Date] ) RETURN IF ( [CreditMeasure] = BLANK (), SUMX ( SUMMARIZE ( FILTER ( ALLSELECTED ( DebitTable ), [Date] <= currDate ), [Month], [Date], "Debit", SUM ( DebitTable[Amount] ), "Credit", CALCULATE ( SUM ( CreditTable[Amount] ), FILTER ( ALLSELECTED ( CreditTable ), CreditTable[Date] IN VALUES ( DebitTable[Date] ) ) ) ), [Debit] - [Credit] ), [DebitMeasure] - [CreditMeasure] )Regards,
Xiaoxin Sheng
Hi Mike, First of all thank you for taking your time to help me out here. Because of the confidentiality of the data, I am unable to share my original table/pbix file. But below are the sample data tables that I have created which are almost similar to my data. Month Table is join by month with other two tables. And I have below 3 measure as well.
DebitMeasure = CALCULATE(SUM(DebitTable[Amount]),SUMMARIZE(DebitTable, DebitTable [Month]))
CreditMeasure = CALCULATE(SUM(CreditTable[Amount]),SUMMARIZE(CreditTable, DebitTable [Month]))
VarianceMeasure = IF(CreditTable[CreditMeasure]=BLANK(),BLANK(),DebitTable[DebitMeasure])-CreditTable[CreditMeasure])
Thanks again.
HI NishPatel,
You can try to use the following measure formula if it suitable for your requirement:
VarianceMeasure =
VAR currDate =
MAX ( DebitTable[Date] )
RETURN
IF (
[CreditMeasure] = BLANK (),
SUMX (
SUMMARIZE (
FILTER ( ALLSELECTED ( DebitTable ), [Date] <= currDate ),
[Month],
[Date],
"Debit", SUM ( DebitTable[Amount] ),
"Credit",
CALCULATE (
SUM ( CreditTable[Amount] ),
FILTER (
ALLSELECTED ( CreditTable ),
CreditTable[Date] IN VALUES ( DebitTable[Date] )
)
)
),
[Debit] - [Credit]
),
[DebitMeasure] - [CreditMeasure]
)
Regards,
Xiaoxin Sheng