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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Remmie0
Regular Visitor

Dynamic names in field parameters (Selectedvalue)

Hi community,

 

I am trying to get dynamic column names in my tables in a way that it always shows the Gross revenue for the selected year and the year before. 
I am using a field parameter and I have tried the below code (and max, last date etc etc) 

 

_DynamicMeasuresGrossRevenue =
{
    ("Gross Revenue " & SELECTEDVALUE('Calendar (Posting Date)'[Year]), NAMEOF('_Measures'[Gross Revenue]), 0),
    ("Gross Revenue " & SELECTEDVALUE('Calendar (Posting Date)'[Year])-1, 1)
}

But it won't show the selectedvalue in the report. 
I think this should have been one of the basic functionalities and I can't seem to get it working. 
I know I can change the names dynamically with current date and last month or current year last year etc, but I want the 'SELECTED' years and not only to compare against current year. https://www.youtube.com/watch?v=9_2m5Csr55c&t=186s&ab_channel=Hari%27sBI This video showed me how to change my name but not without selectedvalue (It is not my video or anyone I know, just an example that it should be possible)

I only found one other post about this in all posts online and it got no answer and over 100 views. https://stackoverflow.com/questions/75338705/using-selectedvalue-with-field-parameter-prior-period-t...

What I want to achieve is when I select 2022 to have the columns Gross Revenue 2022, Gross Revenue 2021 and all my other columns. When I select 2021 I expect to have Gross Revenue 2021, 2020 and all my others etc.

Right now it is showig as blank when I use selectedvalue, and while today, hardcoded values etc seem to work, max(Year), Selectedvalue(Year) do not seem to work. 
Remmie0_0-1680854898132.pngRemmie0_1-1680854941176.png

 

 


I can not share the actual data as it is sensitive, but I would like to be able to use dynamic names as I want to do this for revenue, sales quantity etc. The values do update and show selected year and last year, but the column name doesn't.


Gross revenue is defined as SUM(Gross Revenue)
Gross revenue last year is defined as 
_Gross Revenue LastYear =
VAR SelectedYear = SELECTEDVALUE('Calendar (Posting Date)'[Year])
RETURN

CALCULATE(
    [Gross Revenue],
    FILTER(
        ALL('Calendar (Posting Date)'),
        'Calendar (Posting Date)'[Year] >= SelectedYear - 1 && 'Calendar (Posting Date)'[Year] <+ SelectedYear
    )
)

If anyone could help me out it would be highly appreciated, 
Kind regards. 
22 REPLIES 22

@lbendlin Even if you get the sample data in the format you expect, I strongly believe you have no idea about the solution. 🙂
So, pls stop harressing this topic and don't waste anyone's time! 🙂 

I've provide sample data in my first (edited) post, also include the DAX codes I used.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors