The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Solved! Go to Solution.
I'm a bit lost. A measure cannot return a table, only a scalar, so that would be the first issue.
IN seems to require a table expression as second argument so, since a measure can only be a scalar, it makes sense that it doesn't admit it. Maybe if you provide some sample data and describe exactly what count is supposed to do (you mention MIN, MAX) we can find a workaround
Hi @AGo
I'm not sure I understand completely but two things stand out:
1. Looks like you would need CALCULATETABLE in [ListMeasure]. I assume the list can be more than just one row.
2. Why do you need the measure at all in 'Count'? How about
Count = COUNTROWS ( FILTER ( PBI100_TOTAL; PBI100_TOTAL[Delivery Date] IN CALENDAR ( "2019-01-01"; "2019-05-31" ) ) )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
Tried CALCULATETABLE but no important changes: Can't I write IN and then a measure that returns a multi-rows list? Is there a workaround for this?
Consider that:
I need the ListMeasure because I will use it in a lot of other measures,
the arguments of CALENDAR will be substituted with a MIN and MAX functions,
I will make another function ListMeasure2, similar but with other date conditions.
Thanks @AlB
I'm a bit lost. A measure cannot return a table, only a scalar, so that would be the first issue.
IN seems to require a table expression as second argument so, since a measure can only be a scalar, it makes sense that it doesn't admit it. Maybe if you provide some sample data and describe exactly what count is supposed to do (you mention MIN, MAX) we can find a workaround
Thank you, this is a solution yet. I was lost because using Values or Calculatetable (that has a table as output as from the MS documentation) in a measure I was not encountering any error, but you specified measures won't return anything except scalar values. The problem is that only measures are directly affected by filters and I can't use a visual filter to make conditions on a calculated table or column as a parameter. This is a big limit in Power BI, but thank you very much anyway
You won't get an error as you type the code if you use CALCULATETABLE because it is possible that the table returned is a one-row, one-column table (which is basically a scalar). It will only fail at runtime if the value returned is not a scalar. In any case, if you care to explain more in detail (with an example) what it is that you need maybe we can find a solution.
Cheers