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
NimaiAhluwalia
Responsive Resident
Responsive Resident

Dynamic Column for values by year

Hello

 

I have some quantity in a column and a date assosiated to it.

NimaiAhluwalia_2-1666830610301.png

 

i want to calculate and make a dynamic calculated measure in my visual which when more years will populate my matrix should also populate in the below fashion with increasing years of data. i dont want to create seperate dax measures or all the years.( it should automaticaly populate in my visual when a new year with a quantity comes in.

 

 

Target output format 

NimaiAhluwalia_1-1666830441579.png

 

if it is not possible in a measure can we do it on a calculated column, i guess we can do it with the help of addcolumns dax not sure?

 

@amitchandak 

1 ACCEPTED SOLUTION
Anany
Helper I
Helper I

Hi Nimai,

 

I'm not sure if that is possible in Power BI but there is a workaround for this.  I've tried to recreate your use case with sample data and this is what I've achieved.

You need to create an additional KPI table for this- I've added the values in the year column up to 2030 (you can add more if required).

If there were sales available for the particular year then one column will be automatically added to this matrix.

For ex- If you add the Sales for 2025 in the sample excel sheet and hit refresh it will automatically add one column in the matrix named "2025" under sales which will show the sales for the year 2025.

I hope this suffices your requirements. Thanks

Anany_0-1667307484546.png

Files-

https://docs.google.com/spreadsheets/d/1edW2FHS2qltGZiJ8TUmS3JAbGgo29le-/edit?usp=sharing&ouid=10170...

https://drive.google.com/file/d/1kNKmA8synCCvomaUrnJtpUxJBBmiSs7N/view?usp=sharing






View solution in original post

3 REPLIES 3
Anany
Helper I
Helper I

Hi Nimai,

 

I'm not sure if that is possible in Power BI but there is a workaround for this.  I've tried to recreate your use case with sample data and this is what I've achieved.

You need to create an additional KPI table for this- I've added the values in the year column up to 2030 (you can add more if required).

If there were sales available for the particular year then one column will be automatically added to this matrix.

For ex- If you add the Sales for 2025 in the sample excel sheet and hit refresh it will automatically add one column in the matrix named "2025" under sales which will show the sales for the year 2025.

I hope this suffices your requirements. Thanks

Anany_0-1667307484546.png

Files-

https://docs.google.com/spreadsheets/d/1edW2FHS2qltGZiJ8TUmS3JAbGgo29le-/edit?usp=sharing&ouid=10170...

https://drive.google.com/file/d/1kNKmA8synCCvomaUrnJtpUxJBBmiSs7N/view?usp=sharing






amitchandak
Super User
Super User

@NimaiAhluwalia , if you have joined your data with date table having year. You can take the year on the column of matrix.

 

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Sure i will explain with proper example

 

I am using a table visual not a matrix visual.

I have my data of quantity with diffrernt dates.

NimaiAhluwalia_0-1667265354930.png

 

My traget is to create a dynamic calculation in a way when new year adds in my data i should get a new column with that year in my visual.

 

Currently i am creating seperate measures for each year and putting in the visual which i cannot create for every year in future, so wanted to make it dynamic.

NimaiAhluwalia_3-1667265576450.png

 

NimaiAhluwalia_2-1667265540290.png

 

 

NimaiAhluwalia_1-1667265426310.png

 

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.

Top Solution Authors