Forum Discussion

nicholas_goodye's avatar
nicholas_goodye
Frequent Visitor
9 months ago
Solved

Ordering Detail Level Table by Total Count of Rows per Location

The data: LocationTable LocationID   LocationName 001 A 002 B 003 C IncidentTable LocationID   IncidentID    Date 003 1 10/1/25 003 2 7/1/25 003 ...
  • Zanqueta's avatar
    9 months ago

    Hello nicholas_goodye ,

    I tested the function bellow and worked here;



    CountOfIncidents_LastMonth = 
    VAR StartOfLastMonth = EDATE(DATE(YEAR(TODAY()), MONTH(TODAY()), 1), -1) 
    VAR StartOfThisMonth = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
    RETURN
        CALCULATE(
            COUNTROWS('IncidentTable'),
            'IncidentTable'[Date] >= StartOfLastMonth,
            'IncidentTable'[Date] < StartOfThisMonth
        )


    If this answer solves your problem, please mark it as correct to help other community members.