Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Scenario:
Connected to a Live PowerBI dataset that I don't have access to edit.
Have several Narrative text blurbs that I want to display on various pages of a report, and I want them to be dynamic based on the month and year selected from a slicer.
I created a measure which works, and updates when the user changes the slicer month/year.
SelectedPersonalSupportText =
VAR textTable =
DATATABLE(
"Year", INTEGER,
"Month Num", INTEGER,
"Textstring1", STRING,
"TextString2", STRING,
{
{2023, 3, "Long text string1", "Long Text string2" },
{ 2023, 2, "long text string1 2", "Long Text string2 2"}
}
)
VAR maxYear = YEAR([Max Date ALLSELECTED])
VAR maxMonth = MONTH([Max Date ALLSELECTED])
VAR filteredTable =
FILTER(textTable, [Month Num] = maxMonth && [Year] = maxYear)
RETURN
IF(
COUNTROWS(
FILTER(
textTable,
[Month Num] = maxMonth && [Year] = maxYear
)
) = 1 ,
MINX(filteredTable, [Textstring1]
),
"No analysis text available"
)
What I would like to do is break the filtered DATATABLE() out into a seperate measure for ease of maintenance. So that my measure to capture the text and get the value for each text box is a something like this.
Personal Support Text =
VAR temptextTable =
DATATABLE(
"Year", INTEGER,
"Month Num", INTEGER,
"Textstring", STRING,
{
{2023, 3, "Personal Support slipped $1.316 million (-3.7%) for a total of $33.954 million. That too was the third best on record following 2021 and 2022. However, we are down $7 million on the Fiscal Year to date....." },
{ 2023, 2, "Someother text that we can replace with"}
}
)
VAR maxYear = YEAR([Max Date ALLSELECTED])
VAR maxMonth = MONTH([Max Date ALLSELECTED])
VAR filtTable = FILTER(temptextTable, [Month Num] = maxMonth && [Year] = maxYear)
RETURN
filtTable
SelectedPersonalSupportText TEST =
VAR _table = [Personal Support Text]
RETURN
IF(
COUNTROWS(_table) = 1 ,
MINX([_table], [Textstring]
),
"No analysis text available"
)
If I copy the [Personal Support Text] measure into DAX Studio gives me the one row table as expected from the results, but trying to use this combo in the actual report results in a syntax/semantic error.
What gives? Thanks!
Solved! Go to Solution.
@FleetyBob Unfortunately you cannot return a table for a measure. Measures only support returning scalar values. You could use TOCSV as the return for your measure and then use this FROMCSV but it may be more hassle than its worth: FROMCSV - Microsoft Power BI Community
@FleetyBob Unfortunately you cannot return a table for a measure. Measures only support returning scalar values. You could use TOCSV as the return for your measure and then use this FROMCSV but it may be more hassle than its worth: FROMCSV - Microsoft Power BI Community
Thank you Greg for the response. While I knew you couldn't return a table through a measure to a visual I guess I was optimistacally incorrect that I could use a meaure as a Global variable that could be passed to several other measures. Back to the drawing board. I will look into the TOCSV/FROMCSV as a possible solution.
Cheers!