Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
WTAS80486
Helper IV
Helper IV

How to Calculate cumulative count from one table based on months in another table

Measure is:

 

COUNT() = COUNTX(FILTER(Table 1, Table 1[PM/CM] = "Corrective"

&& Table 1[Month Number(Failed Date)] <> BLANK()

&& Table 1[Month Name(Failed Date)] =MAX('Table 2[Month Name])),  Table 1[PM/CM])

 

‘Table 1’  filtered by asset no:

 

It has dec, Jan and June entries for this asset

 

 

It also has this column Table1[PM/CM]

 

Table 2 looks like this and has nov-jul entries

 

 

Now cumulative count has to be calculated Nov to Jul

 

Ankita80486_2-1660050624678.png

 

 

Ankita80486_3-1660050624680.png

 

 

So for Jan count should be 3 and march also 3.

 

Can anyone help!

 

 

2 ACCEPTED SOLUTIONS
SpartaBI
Community Champion
Community Champion

@WTAS80486 make sure you have the proper dimensions between the different facts and don't created a relationship between the facts themselves.
And create these measures:

COUNT(failures_month) V2 = 
COUNTROWS(
    FILTER(
        Workorder_with_assetdowntime_MTBF, 
        Workorder_with_assetdowntime_MTBF[PM/CM] = "Corrective" 
            && Workorder_with_assetdowntime_MTBF[Month Number(Failed Date)] <> BLANK()
    )
)

COUNT(failures_month) V2 Cummulative = 
VAR _max_date = max('Date'[Date])
VAR _max_peossible_date = MAX(Workorder_with_assetdowntime_MTBF[Failed Date New])
RETURN
CALCULATE(
    [COUNT(failures_month) V2], 
    'Date'[Date] <= _max_date && 'Date'[Date] <= _max_peossible_date
)

View solution in original post

Change this part:

IF(
    _max_date <= _max_peossible_date,
 
To this
 
IF(
EOMONTH(  _max_date, -1) <= _max_peossible_date,

View solution in original post

5 REPLIES 5
WTAS80486
Helper IV
Helper IV

@SpartaBI Its working! Thanks so much!

SpartaBI
Community Champion
Community Champion

@WTAS80486 make sure you have the proper dimensions between the different facts and don't created a relationship between the facts themselves.
And create these measures:

COUNT(failures_month) V2 = 
COUNTROWS(
    FILTER(
        Workorder_with_assetdowntime_MTBF, 
        Workorder_with_assetdowntime_MTBF[PM/CM] = "Corrective" 
            && Workorder_with_assetdowntime_MTBF[Month Number(Failed Date)] <> BLANK()
    )
)

COUNT(failures_month) V2 Cummulative = 
VAR _max_date = max('Date'[Date])
VAR _max_peossible_date = MAX(Workorder_with_assetdowntime_MTBF[Failed Date New])
RETURN
CALCULATE(
    [COUNT(failures_month) V2], 
    'Date'[Date] <= _max_date && 'Date'[Date] <= _max_peossible_date
)

Thanks @SpartaBI for the solution. You are so helpful!

@SpartaBI 

 

This measure:

 

COUNT(failures_month) V2 Cummulative =
VAR _max_date = max('dimDate'[Date])
VAR _max_peossible_date = calculate(max(MAX(Workorder_with_assetdowntime_MTBF[Date(Failed)]),MAX('Runhours_Total Hours_By Month'[Date(Start)])), REMOVEFILTERS(dimDate),  Workorder_with_assetdowntime_MTBF[PM/CM] = "Corrective"
            ,Workorder_with_assetdowntime_MTBF[Month Name(Failed Date)] <> BLANK())
RETURN
IF(
    _max_date <= _max_peossible_date,
    CALCULATE(
        [COUNT(failures_month) V2],
    'dimDate'[Date] <= _max_date
    )+0
)
 
 
Is not populating cumulative count for last month, JULY in this case, This last month is Date(start) from runhours_totalhours table. 
 
Ankita80486_1-1660074110061.png

Date(failed) from workorder_with_asset downtime table

 

Ankita80486_2-1660074177708.png

 

 

 

Change this part:

IF(
    _max_date <= _max_peossible_date,
 
To this
 
IF(
EOMONTH(  _max_date, -1) <= _max_peossible_date,

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.