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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Syndicate_Admin
Administrator
Administrator

Variable that can be read throughout the project

Hello guys how are you, my question is the following and I've been trying to solve it for a while, I have a report in which there are several tables calculated and almost most of them use this format to update them:


Tbl_BXALLMKTS =
VAR SEM = {45,46,47,48,49,50,51,52,1,2,3,4,5,6}
RETURN
SUMMARIZE (
Data,Data[SEASON], Data[Color],
"BX", CALCULATE(SUM(Data[BX]), Data[Week] in SEM))

I also have this other code with another question:


Tbl_DPT =
SUMMARIZE (
Data,Data[YEAR], Data[Color],
"1", CALCULATE(SUM(Data[Boxes]), Data[Week] IN {1} ),
"2", CALCULATE(SUM(Data[Boxes]), Data[Week] IN {2} ),
"3", CALCULATE(SUM(Data[Boxes]), Data[Week] IN {3} ),
"4", CALCULATE(SUM(Data[Boxes]), Data[Week] IN {4} ),
"5", CALCULATE(SUM(Data[Boxes]), Data[Week] IN {5} ),
"6", CALCULATE(SUM(Data[Boxes]), Data[Week] IN {6} ),
"TOTAL", CALCULATE(SUM(Data[BX]), Data[Week] IN {45,46,47,48,49,50,51,52,1,2,3,4,5,6} )
)

It could be done with a for or while the part of the creation of the fields with the week number, where I give it the initial and final week and I create that part of the code
The idea is not to spend so much time adding the new week number in all the tables and code
Greetings and I hope you can help me
If you don't understand what I asked, let me know and I can give you more details

1 REPLY 1
parry2k
Super User
Super User

@Syndicate_Admin it will be easier if you share sample data with the expected output.  Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors