The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hey there,
File link here
I'm trying to dynamically return a table based on a slicer selection, as shown in the following image:
What does that means? If, in the field paramenter based slicer, it's selected the DateShortened, then the table will generate a list with all the dates of the calendar dimension table; so for the weeks and the months.
The problem lies in the usage of the ALL() function, because when I try to use the column from the calendar table inside this ALL() filter on the CALCULATE formula, the following message error pops up:
The ALL function expects a table reference expression for argument '1', but a string or numeric expression was used.
Is there any way to make this dynamic? The only workaround I manage to found was using the ISINSCOPE() function, but in my real life dataset I use too many columns that it turns out to be very slow in a performance point of view (because of the CallBackDataID in the SWITCH() formula).
Thanks in advance.
Solved! Go to Solution.
Hi @Pedro503 ,
Please try:
SalesAmountAll =
SWITCH (
MAX ( 'P_Date'[P_Date] ),
"Week", CALCULATE ( [SalesAmount], ALL ( d_calendar[Week] ) ),
"MonthYear", CALCULATE ( [SalesAmount], ALL ( d_calendar[MonthYear] ) ),
"DateShortened", CALCULATE ( [SalesAmount], ALL ( d_calendar[DateShortened] ) )
)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Pedro503 ,
Please try:
SalesAmountAll =
SWITCH (
MAX ( 'P_Date'[P_Date] ),
"Week", CALCULATE ( [SalesAmount], ALL ( d_calendar[Week] ) ),
"MonthYear", CALCULATE ( [SalesAmount], ALL ( d_calendar[MonthYear] ) ),
"DateShortened", CALCULATE ( [SalesAmount], ALL ( d_calendar[DateShortened] ) )
)
Final output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
80 | |
80 | |
48 | |
40 |
User | Count |
---|---|
150 | |
110 | |
64 | |
64 | |
58 |