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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
kemaley
Frequent Visitor

GenerateSeries Function Cannot Be Blank Error

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.

1 ACCEPTED SOLUTION

@kemaley,

 

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/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
DataInsights
Super User
Super User

@kemaley,

 

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 )

 





Did I answer your question? Mark my post as a solution!

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.

@kemaley,

 

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/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.