Forum Discussion

Ncsbr's avatar
Ncsbr
Frequent Visitor
3 years ago
Solved

Difference Between First Month and Current Month in a YTD Id Count

Hi,   I'm trying to calculate the difference between the count of Id's of the first month of the year and the current month count, but I'm having some issues to get it. As the example below, I...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Ncsbr ,

    Please refer to it to see if it helps you.

    Create a column.

    month = MONTH('Table'[date])

    Then create a measure.

    Measure = var _year=YEAR(TODAY())
    var _yeardate=YEAR(MAX('Table'[date]))
    var _1=MAXX(FILTER(ALL('Table'),_yeardate=_year),'Table'[month])
    var _2=MINX(FILTER(ALL('Table'),_yeardate=_year),'Table'[month])
    var _maxdate=CALCULATE(MAX('Table'[count]),FILTER(ALL('Table'),'Table'[month]=_1))
    var _mindate=CALCULATE(MAX('Table'[count]),FILTER(ALL('Table'),'Table'[month]=_2))
    return
    _maxdate-_mindate

    The result is 14644-13741=903.

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

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