Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I would like to make this formula more generic and taking the value "W29" (or other weeks..) from a column that stores this info. W29 is indeed the table name and is present in column [Reporting Week] as well. Of course, we have many more tables for w28, w27 and so on
Original formula that works but is not mantainable:
SOH = IF([Reporting Week]="W29",CALCULATE(SUM(W29[Entr/bes.]),ALL(W29),W29[Dem/need]="Stock",W29[Article]=earlier('Material/week'[Material]), W29[Date2] <= EARLIER('Material/week'[date])) ...
What I try to do (in excelish terms, using INDIRECT)
SOH = CALCULATE(SUM(INDIRECT(earlier[Reporting Week]&[Entr/bes.]),ALL(INDIRECT(earlier[Reporting Week]),INDIRECT(earlier[Reporting Week]&[Dem/need]="Stock",INDIRECT(earlier[Reporting Week]&[Article]=earlier('Material/week'[Material]), INDIRECT(earlier[Reporting Week]&[Date2] <= EARLIER('Material/week'[date]))
Is there any option to do this in DAX?
Thanks in advance community!
@Pitrus , what are you trying to get here.
In case you are looking for WOW data, refer
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
Hi,
Thanks for the answer.
I am actually looking for referring a table name as a variable. Something like this:
SOH2 =
VAR W=[Reporting Week]
RETURN
CALCULATE(SUM(W[Entr/bes.]),ALL(W),W[Dem/need]="Stock",W[Article]=earlier('Material/week'[Material]))
But it does not work 😞
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
9 |