Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Dear Power BI community!
I have a pretty complex situation that has been keeping me busy for weeks, after which I decided I can't find a good solution. The below situation is somewhat simplified.
The issue is as follows:
Based on this, I would like to calculate the monthly number of processed complaints as follows:
Lastly, I'd like to create an overview where the KPI is presented on a monthly basis (timeliness% January, timeliness% February, etc) for the last 8 or so months, preferably following the current date using relative date being the last 8 months (i.e. when we reach the new month, the previous month is automatically added and the oldest month is dropped).
Can someone please help me how to approach this and what the correct coding is?
For example, for the column OpenOnTime, I created the following, which doesn't seem to work:
OpenOnTime =
VAR Dates =
SELECTEDVALUE(DataTable[Date])
RETURN
CALCULATE(
COUNTX(
'data complaints',
'data complaints'[ComplaintId]),
FIRSTDATE(DataTable[Date]),
'data complaints'[DateStart] <= Dates &&
('data complaints'[DateEnd] > Dates || 'data complaints'[DateEnd] = BLANK()) &&
'data complaints'[DateDue] > Dates)
)
Any help would be MUCH appreciated. Thank you in advance!
Solved! Go to Solution.
HI @Anonymous,
You can extract the current date from date table and use this as condition to filter and calculate with 'fact' table records:
OpenOnTime =
VAR currDate =
    MAX ( DataTable[Date] )
RETURN
    CALCULATE (
        COUNT ( 'data complaints'[ComplaintId] ),
        FILTER (
            ALLSELECTED ( 'data complaints' ),
            AND (
                'data complaints'[DateStart] <= currDate,
                OR (
                    'data complaints'[DateEnd] > currDate,
                    'data complaints'[DateEnd] = BLANK ()
                )
                    && 'data complaints'[DateDue] > currDate
            )
        )
    )
Regards,
Xiaoxin Sheng
HI @Anonymous,
You can extract the current date from date table and use this as condition to filter and calculate with 'fact' table records:
OpenOnTime =
VAR currDate =
    MAX ( DataTable[Date] )
RETURN
    CALCULATE (
        COUNT ( 'data complaints'[ComplaintId] ),
        FILTER (
            ALLSELECTED ( 'data complaints' ),
            AND (
                'data complaints'[DateStart] <= currDate,
                OR (
                    'data complaints'[DateEnd] > currDate,
                    'data complaints'[DateEnd] = BLANK ()
                )
                    && 'data complaints'[DateDue] > currDate
            )
        )
    )
Regards,
Xiaoxin Sheng
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.