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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Mister_PowerBI
Frequent Visitor

Spread projectvalue across now and project_end_date

Hello everybody, 

 

I have a hard time getting this figured out and was hoping maybe somebody can help me out .

 

Let's say I have a database with projects that have an end_date and a remaining_project_value column. I would like to spread the remeaning_project_value over the dates between UTCNOW() and end_date and show this in an interactive visual that can be switched. So the visual needs to be able to switch from week to month, and show the remaining_project_value accordingly. 

 

Can anybody put me in the right direction?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Mister_PowerBI ,

I created some data:

vyangliumsft_0-1671673801760.png

Here are the steps you can follow:

1. Create calculated column.

Week = WEEKNUM('Table'[end_date ],2)

2. Enter data – create  a table.

vyangliumsft_1-1671673801762.png

3. Create measure.

Flag =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
var _today=TODAY()
var _minweekdate=
MINX(FILTER(ALL('Table'),YEAR('Table'[end_date ])=YEAR(MAX('Table'[end_date ]))&&'Table'[Week]=
MINX(FILTER(ALL('Table'),'Table'[end_date ]=_today),[Week])),[end_date ])
return
SWITCH(
    TRUE(),
    MAX('Slicer_Table'[Slicer])="Month"&&MAX('Table'[end_date ])>=DATE(YEAR(_today),MONTH(_today),1)&&MAX('Table'[end_date ])<=_today,1,
    MAX('Slicer_Table'[Slicer])="Week"&&MAX('Table'[end_date ])>=_minweekdate&&MAX('Table'[end_date ])<=_today,1,
    0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1671673801763.png

5. Result:

vyangliumsft_3-1671673801764.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  @Mister_PowerBI ,

I created some data:

vyangliumsft_0-1671673801760.png

Here are the steps you can follow:

1. Create calculated column.

Week = WEEKNUM('Table'[end_date ],2)

2. Enter data – create  a table.

vyangliumsft_1-1671673801762.png

3. Create measure.

Flag =
var _select=SELECTEDVALUE('Slicer_Table'[Slicer])
var _today=TODAY()
var _minweekdate=
MINX(FILTER(ALL('Table'),YEAR('Table'[end_date ])=YEAR(MAX('Table'[end_date ]))&&'Table'[Week]=
MINX(FILTER(ALL('Table'),'Table'[end_date ]=_today),[Week])),[end_date ])
return
SWITCH(
    TRUE(),
    MAX('Slicer_Table'[Slicer])="Month"&&MAX('Table'[end_date ])>=DATE(YEAR(_today),MONTH(_today),1)&&MAX('Table'[end_date ])<=_today,1,
    MAX('Slicer_Table'[Slicer])="Week"&&MAX('Table'[end_date ])>=_minweekdate&&MAX('Table'[end_date ])<=_today,1,
    0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_2-1671673801763.png

5. Result:

vyangliumsft_3-1671673801764.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
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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