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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Syndicate_Admin
Administrator
Administrator

Assign measurement between date range

Hello!

I have a table with the following columns:

LoloGox_0-1654856317676.png

In which a valid price date range between Date1 and Date2 is indicated. What you are trying to do is create a table/column from 01/01/2022 to 31/12/2022 assigning the price corresponding to the range that is established. Example:

LoloGox_1-1654856741652.png

Greetings.

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Please create the new table.

 

Dates = 
ADDCOLUMNS (
    CALENDAR ( MIN ( 'Table'[Date1] ), MAX ( 'Table'[Date2] ) ),
    "Price",
        CALCULATE (
            SUM ( 'Table'[Price] ),
            FILTER ( 'Table', 'Table'[Date1] <= [Date] && 'Table'[Date2] >= [Date] )
        )
)

vkkfmsft_0-1655102656016.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

I have a job in pbi where based on the maximum date of the context I must generate 8 months ahead and make some estimates using the data of the selected range of dechas. I made a separate calendar to use it in the second matrix q is generated from the maximum date, the problem is q grabs the maximum date of the main calendar and not the max date of the q context is the q I need.

v-kkf-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

Please create the new table.

 

Dates = 
ADDCOLUMNS (
    CALENDAR ( MIN ( 'Table'[Date1] ), MAX ( 'Table'[Date2] ) ),
    "Price",
        CALCULATE (
            SUM ( 'Table'[Price] ),
            FILTER ( 'Table', 'Table'[Date1] <= [Date] && 'Table'[Date2] >= [Date] )
        )
)

vkkfmsft_0-1655102656016.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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