Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 @Anonymous ,
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 @Anonymous ,
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.
This was helpful for me too, thank you. Could someone explain why MAX (in this MAX( 'P_Date'[P_Date] ) ) works but not SELECTEDVALUE? For me SELECTEDVALUE would be the intuitive choice as the values are text.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 67 | |
| 31 | |
| 27 | |
| 24 |