Forum Discussion
Dynamically changing fields in table
Hi all,
How can I make this table dynamic in power BI. In next week, when the source data is updated with a new week (week 23) then this table should automatically gets refreshed like (week 18 should be removed and week 23 should be added in the feild)
Hello,
Assumption: The weeks will be displayed only for a selected year. (i.e. the weeks are all from the same year and not from 2 different years).
You can follow the below steps and achieve the requirement:
1. Create a duplicate column of the Week Name. [ex: "Week 18 (2-8 May)" ]
2. Split the text with space delimiter and retain the column which gives the week number only. (i.e. 18, 19, 20 etc.)
3. Create a measure finding maximum of the week number.MaxWeek = Calculate(MAX('Table'[Week Number]), ALL())
4. Create a calculated column which gives difference of MaxWeek with the week number.5. Now in the matric visual, add a filter for Diff -> Advanced filtering -> is less than 4Diff = [MaxWeek] - 'Table'[Week Number]
This will always show the top 4 weeks only.
If weeks need to be taken irrespective of the year, then the logic for finding max week will change all others remain same.thanks for the link, it worked.
Rahul_SC
Would you please consider marking my reply as acceptable soltion? Thank you
5 Replies
- krohitraoRegular Visitor
Hello,
Assumption: The weeks will be displayed only for a selected year. (i.e. the weeks are all from the same year and not from 2 different years).
You can follow the below steps and achieve the requirement:
1. Create a duplicate column of the Week Name. [ex: "Week 18 (2-8 May)" ]
2. Split the text with space delimiter and retain the column which gives the week number only. (i.e. 18, 19, 20 etc.)
3. Create a measure finding maximum of the week number.MaxWeek = Calculate(MAX('Table'[Week Number]), ALL())
4. Create a calculated column which gives difference of MaxWeek with the week number.5. Now in the matric visual, add a filter for Diff -> Advanced filtering -> is less than 4Diff = [MaxWeek] - 'Table'[Week Number]
This will always show the top 4 weeks only.
If weeks need to be taken irrespective of the year, then the logic for finding max week will change all others remain same.