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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
fedeleu
Frequent Visitor

DATESINPERIOD Measure Problem

Hi,

I have a model with 3 measures thats works OK. This is a table that shows measures values.

 

imagen1.PNG

 

where measure_3 = measure_1 * measure_2

 

I must calculate the accumulated value at 12 months.

 

I created measure_4=Calculate (measure_3,DATESINPERIOD(Calendar[Date],Max(Calendar[Date]),-1,YEAR), but I did not get the expected values.

 

This is a table with expected vs obtained values.

 

fedeleu_0-1634067590478.png

 

Can someone tell me where is the mistake I am making?

 

Regards,

Federico

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @fedeleu ,

Here are the steps you can follow:

1. Create measure.

Measure =
SUMX(FILTER(ALL('Table'),'Table'[Date]<=MAX('Table'[Date])&&'Table'[Date]>DATE(YEAR(MAX('Table'[Date]))-1,MONTH(MAX('Table'[Date])),DAY(MAX('Table'[Date])))),[Measure_3])
flag =
var _min=MINX(ALL('Table'),'Table'[Date])
return
IF(_min<=MAX('Table'[Date])&&MAX('Table'[Date])>=DATE(YEAR(_min)+1,MONTH(_min),DAY(_min)),1,0)

2. Place [Flag] in Filter and set is = 1.

vyangliumsft_0-1634262637534.png

3. Result:

vyangliumsft_1-1634262637537.png

Best Regards,

Liu Yang

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @fedeleu ,

Here are the steps you can follow:

1. Create measure.

Measure =
SUMX(FILTER(ALL('Table'),'Table'[Date]<=MAX('Table'[Date])&&'Table'[Date]>DATE(YEAR(MAX('Table'[Date]))-1,MONTH(MAX('Table'[Date])),DAY(MAX('Table'[Date])))),[Measure_3])
flag =
var _min=MINX(ALL('Table'),'Table'[Date])
return
IF(_min<=MAX('Table'[Date])&&MAX('Table'[Date])>=DATE(YEAR(_min)+1,MONTH(_min),DAY(_min)),1,0)

2. Place [Flag] in Filter and set is = 1.

vyangliumsft_0-1634262637534.png

3. Result:

vyangliumsft_1-1634262637537.png

Best Regards,

Liu Yang

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

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors