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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
kmilarov
Helper II
Helper II

Measure with column filter and date range up to next period

Hi Guys,

I know there ar emany simialr topics, but still cnanot solve it for my model.

 

I have a table with few columns - one is Due Date (date format from past year up to years in the future ) and one column Critical - with 1 or 0. I want to create a measure to :

 

calluclate the number of the Critical rows (=1) for the oeriod up to whateevr months (for exampel up to 2 months ).

 

Screenshot 2024-02-25 102443.png

 

I tired Calculate , or/and Filters, coutnrows, SUM etc, but with not good success . For example :

 

CRITs = CALCULATE (
      SUM(Forecast_DB[CRITICAL]),
      DATESINPERIOD ( 'Forecast_DB'[Due Date],          -- returns period from date column
                      TODAY(),  -- starting from MAX date
                      +2,                   -- shifting it back 12 intervals
                      MONTH                  -- each interval being a month
      )
)
 
Any ideas for easy, simple solution ?

 

1 ACCEPTED SOLUTION
KhaiT
Frequent Visitor

Hi @kmilarov ,

 

Your calculation should work with one minor change. 

Instead of using 'Forecast_DB'[Due Date], you'll need use a date table.

 

Here are the steps I tried:

1. Follow 'Generate with Dax' instructions here 

Create date tables in Power BI Desktop - Power BI | Microsoft Learn

 

I named by date table 'Dim_Date'

 

2. Join 'Forecast_DB'[Due Date] to 'Dim_Date'[Date]

 

3. Modify CRITs DAX to use Dim_Date

 

CRITs = CALCULATE (
      SUM(Forecast_DB[CRITICAL]),
      DATESINPERIOD ( 'Dim_Date'[Date],          -- returns period from date column
                      TODAY(),  -- starting from MAX date
                      +2,                   -- shifting it back 12 intervals
                      MONTH                  -- each interval being a month
      )
)

 

Hope this helps.

 

Thanks,

KhaiT

 

 

View solution in original post

2 REPLIES 2
KhaiT
Frequent Visitor

Hi @kmilarov ,

 

Your calculation should work with one minor change. 

Instead of using 'Forecast_DB'[Due Date], you'll need use a date table.

 

Here are the steps I tried:

1. Follow 'Generate with Dax' instructions here 

Create date tables in Power BI Desktop - Power BI | Microsoft Learn

 

I named by date table 'Dim_Date'

 

2. Join 'Forecast_DB'[Due Date] to 'Dim_Date'[Date]

 

3. Modify CRITs DAX to use Dim_Date

 

CRITs = CALCULATE (
      SUM(Forecast_DB[CRITICAL]),
      DATESINPERIOD ( 'Dim_Date'[Date],          -- returns period from date column
                      TODAY(),  -- starting from MAX date
                      +2,                   -- shifting it back 12 intervals
                      MONTH                  -- each interval being a month
      )
)

 

Hope this helps.

 

Thanks,

KhaiT

 

 

Thanks , KhaiT. Your suggestion works very well. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors