Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hello, you can use a variable within a query, for example I have this data that I must change every week within many queries, so I want to change it only in one place and it is updated dynamically in the rest of the queries.
Here's the piece of data I want to pass to a variable or save it within the registry in a table:
Weeks = 44,45,46,47,48,49,50,51,52 ----------> Every week I add another one and as it is in many queries I want to change it only in one place and update it dynamically.
This is one of many queries that I want to use a
NO VARIABLE
******************************************
******************************************
Solved! Go to Solution.
Hi @Syndicate_Admin ,
Based on your description,
You might consider creating a Calculated table.
Here is an example:
My Sample:
WeeksTable = DATATABLE(
"WeekNum", INTEGER,
{{44}, {45}, {46}, {47}, {48}, {49}, {50}, {51},{52}}
)
Use the created Calculated table in the following code, Result is as below.
Measure = CALCULATE(SUM('Table'[Sales]),
FILTER('Table','Table'[Week] IN VALUES(WeeksTable[WeekNum]))
)
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Syndicate_Admin ,
Based on your description,
You might consider creating a Calculated table.
Here is an example:
My Sample:
WeeksTable = DATATABLE(
"WeekNum", INTEGER,
{{44}, {45}, {46}, {47}, {48}, {49}, {50}, {51},{52}}
)
Use the created Calculated table in the following code, Result is as below.
Measure = CALCULATE(SUM('Table'[Sales]),
FILTER('Table','Table'[Week] IN VALUES(WeeksTable[WeekNum]))
)
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
| User | Count |
|---|---|
| 50 | |
| 43 | |
| 36 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 139 | |
| 129 | |
| 61 | |
| 59 | |
| 57 |