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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
imranamikhan
Helper V
Helper V

Repeat Selected Value Across Rows In Measure

Hi everyone,

 

Per the example below, I have the following table which displays the following columns:

 

  • Period Numbers (1-12)
  • Projects Number
  • Value

Source Data.png

 

You will notice above that each project has data for every Period.

 

I have a separate custom table (created in Power Query) which displays each distinct period. The Value column is the result of a measure which returns the associated value for each project per the relevant period.

 

Custom TablePNG.PNG

Problem:

I have another column (Selected Period Value) which should return the associated value for the selected period in a slicer and selected project. This value should repeat across all rows. This is to allow me to run another separate calculation (Difference).

 

In PowerBI, I have attempted to use the SELECTEDVALUE function to return the selected period as a paramater in a measure. But this results in Blank data being returned.

 

Selected Period = SELECTEDVALUE('REF_Programme Financials Unpivot'[Sheet Number (Period)], BLANK())

 

Value = CALCULATE (
SUM ( 'SP_XL_Programme Financials'[Current Authority] ),
FILTER ( ALL ( 'SP_XL_Programme Financials'[Sheet Number (Period)] ), 'SP_XL_Programme Financials'[Sheet Number (Period)] = [Selected Period]),
FILTER ( ALL ( 'SP_XL_Programme Financials'[Project No.] ), 'SP_XL_Programme Financials'[Project No.] = [Selected Project] )
)

 

PowerBI Example.PNG

 

 

If I hardcode the selected value into the measure, the measure returns the required results.
 
Value if Hardcoded = CALCULATE (
SUM ( 'SP_XL_Programme Financials'[Current Authority] ),
FILTER ( ALL ( 'SP_XL_Programme Financials'[Sheet Number (Period)] ), 'SP_XL_Programme Financials'[Sheet Number (Period)] = 12),
FILTER ( ALL ( 'SP_XL_Programme Financials'[Project No.] ), 'SP_XL_Programme Financials'[Project No.] = [Selected Project] )
)


Could anyone please advise how I should approach and resolve this?

 

Best regards,

AmiK

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@imranamikhan , In such cases it better to have separate period table and use that.

 

As per me these two mesures should work

 

Value = SUM ( 'SP_XL_Programme Financials'[Current Authority] )

value selected = calculate([Values], filter(All(Period), Period[period] =selectedvalue(Period[period])))

 

then you can take diff

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
imranamikhan
Helper V
Helper V

@amitchandak  - There was an issue with my data model and the solution now works. Thank you

amitchandak
Super User
Super User

@imranamikhan , In such cases it better to have separate period table and use that.

 

As per me these two mesures should work

 

Value = SUM ( 'SP_XL_Programme Financials'[Current Authority] )

value selected = calculate([Values], filter(All(Period), Period[period] =selectedvalue(Period[period])))

 

then you can take diff

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.