We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello,
My code for parameter is below down
Parameter Month =
VAR MonthMax =
CALCULATE(
MAX(Sales[MyMonth]),
FILTER(
Sales,
Sales[MyMonth]>=1 && Sales[MyMonth]<=12
)
,
Sales[MyYear]=SELECTEDVALUE('Parameter MyYear'[Parameter MyYear])
)
RETURN
GENERATESERIES(1,MonthMax)
It raises "The arguments in GenerateSeries function cannot be blank" error.
However, when I put the MonthMax variable code as a separate measure on a card, I get the correct result. What could be the problem?
Thanks in advance.
Solved! Go to Solution.
The reason is that 2024 is a single value, but the SELECTEDVALUE expression returns BLANK since there is more than one value in 'Parameter MyYear'[Parameter MyYear]. Even though a user may have selected 2024, calculated tables don't recognize user selections (e.g., slicer/filter).
https://dax.guide/selectedvalue/
Proud to be a Super User!
Calculated tables (and calculated columns) are unable to recognize user filters. Measures, however, do recognize user filters. On a side note, it's recommended to use individual filter arguments instead of "&&":
Parameter Month =
VAR MonthMax =
CALCULATE (
MAX ( Sales[MyMonth] ),
Sales[MyMonth] >= 1,
Sales[MyMonth] <= 12,
Sales[MyYear] = SELECTEDVALUE ( 'Parameter MyYear'[Parameter MyYear] )
)
RETURN
GENERATESERIES ( 1, MonthMax )
Proud to be a Super User!
The problem is in the following part of the code
SELECTEDVALUE ( 'Parameter MyYear'[Parameter MyYear] )
When I change this part of the code to 2024, it works. But if I use parameter, it causes the same error.
There is no problem with other measures. But this GenerateSeries function does not accept the parameter value.
The reason is that 2024 is a single value, but the SELECTEDVALUE expression returns BLANK since there is more than one value in 'Parameter MyYear'[Parameter MyYear]. Even though a user may have selected 2024, calculated tables don't recognize user selections (e.g., slicer/filter).
https://dax.guide/selectedvalue/
Proud to be a Super User!
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 57 | |
| 38 | |
| 33 | |
| 19 | |
| 16 |
| User | Count |
|---|---|
| 68 | |
| 66 | |
| 41 | |
| 34 | |
| 25 |