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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DesMoZ
Frequent Visitor

Build a measure regarding reference date from and date to in a table

Hi All,

 

I'm struggled with a dax approach, I've a table "RefValue":

ReferenceDate FromDate ToValue
R101/01/202307/01/2023100
R205/01/202310/01/202333
R315/12/202312/01/202325
R413/01/202315/01/202375

 

I would like to build a measure that will allow me to calculate a report like this : 

Reference01/0102/0103/0104/0105/0106/0107/0108/0109/0110/0111/0112/0113/0114/0115/01
R1100100100100100100100        
R2    333333333333     
R3252525252525252525252525   
R4            757575
Total1251251251251581581585858582525757575

 

And so for exemple if a period is selected in the "calendar table" through a slicer the measure [Total] will return the SUM of the value form this period.

 

So a kind of :

Total = CALCULATE ( Value, CalendarDate >= 'RefValue'[Date From] && CalendarDate <= 'RefValue'[Date To]

 

Thanks for your help.

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @DesMoZ 

try to 

1) add a calculated table with this:

Table2 = 
ADDCOLUMNS(
    CALENDAR(DATE(2023,1,1), DATE(2023,1,15)),
    "DD/MM",
    FORMAT([date], "DD/MM")
)

(No need to relate two tables)

 

2) plot a matrix visual with a measure like this:

Measure = 
VAR _date = MAX(table2[date])
RETURN
SUMX(
    FILTER(table1,table1[Date From]<=_date&&table1[Date To]>=_date),
    table1[Value]
)

 

i tried and it worked like this:

FreemanZ_0-1673449712682.png

 

View solution in original post

2 REPLIES 2
DesMoZ
Frequent Visitor

Many Thanks @FreemanZ it works perfectly

FreemanZ
Super User
Super User

hi @DesMoZ 

try to 

1) add a calculated table with this:

Table2 = 
ADDCOLUMNS(
    CALENDAR(DATE(2023,1,1), DATE(2023,1,15)),
    "DD/MM",
    FORMAT([date], "DD/MM")
)

(No need to relate two tables)

 

2) plot a matrix visual with a measure like this:

Measure = 
VAR _date = MAX(table2[date])
RETURN
SUMX(
    FILTER(table1,table1[Date From]<=_date&&table1[Date To]>=_date),
    table1[Value]
)

 

i tried and it worked like this:

FreemanZ_0-1673449712682.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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