Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Last transaction dynamically

Hello! I'm trying to find the lastest transaction in a dynamic period, I have checked another posts in the forum but they doesnt work. I have tried everything and I can get them but the dynamic cal...
  • v-kkf-msft's avatar
    v-kkf-msft
    5 years ago

    Hi Anonymous ,

    Try the following formula:

    Max_Date = 
    CALCULATE(
        MAX('Table'[Date]),
        ALLSELECTED('Table'),
        GROUPBY('Table','Table'[ID])
    )
    Measure = 
    var result = 
        CALCULATE(
            COUNT('Table'[ID]),
            FILTER(
                ALLSELECTED('Table'),
                'Table'[Date] = [Max_Date]
                && 'Table'[Type] = MAX('Table'[Type])
            )
        )
    return 
        IF(
            HASONEFILTER('Table'[Type]),
            result,
            DISTINCTCOUNT('Table'[ID])
        )

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.