Forum Discussion

NishPatel's avatar
NishPatel
Resolver II
3 years ago
Solved

Dax Measure

I need help with a measure to get result as shown below in column Balance.  If there is no value in Credit column then I dont want to show YTD balance. The measure that I have is    IF(Table1[Credi...
  • Anonymous's avatar
    Anonymous
    3 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