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
FabrizioLorito
New Member

Problem with SELECTEDVALUE

Hi

I have a simple data table with years (Anno) ranging from 2021 to 2023

FabrizioLorito_0-1713879446510.png

I have created two tables just with the list of years

f_start = summarize(Dati,Dati[Anno])
f_end = summarize(Dati,Dati[Anno])
I have applied a slicer to both to get a selection of one year from f_start and one for tear f_end  

 

FabrizioLorito_4-1713879797871.png

I want to create a table like this

FabrizioLorito_2-1713879757838.png

Where, corresponding to each Segment, I have the sum of all the values from the selected Start year and from the End year

 

Now, if I build a new table like the following it returns me a blank table:

TabStarEnd =
var s_start=selectedvalue(f_start[Anno])
var s_end=selectedvalue(f_end[Anno])

return

ADDCOLUMNS(    
    SUMMARIZE(
        Dati,
        [Segmento]
    ),
    "Start",CALCULATE(
        SUMX(filter(Dati,Dati[Anno]=s_start),Dati[Ordinato])
    ),
    "End",CALCULATE(
        SUMX(filter(Dati,Dati[Anno]=s_end),Dati[Ordinato])
    )
)

Instead, if I force "2021" and "2023" in s_start and s_end respectively it works (and gives the result I have shown before)

 

Why is function SELECTEDVALUE not working?

Thanks

Fabrizio

 

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Slicers don't affect calculated columns or tables.

---

You could create 2 measures and use them in a table visual to get what you want.

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

Slicers don't affect calculated columns or tables.

---

You could create 2 measures and use them in a table visual to get what you want.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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