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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
FleetyBob
Frequent Visitor

Passing a virtualized table from one measure to another measure variable

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.

Screenshot 2023-04-28 at 2.32.59 PM.png

 

What gives? Thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.