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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

DAX command from a string

Hi,

I was wondering if it is possible to store all my DAX measures in a field in a table.

I'm thinking about creating a kind of knowledge base whre I can store all the measures my company could use. In this table I would have a text field contaning the measure itself, plus others fields for example to explain what the measure does, what are the tables necessary to excute them and may others informations.

I know I can store the measure as a string, but how would I convert that string into a valid DAX command in Power BI?

Is this possible?

Thank you.

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@Anonymous  yes it is absolutely possible. If you are publishing the model in a workspace, you can write DMV queries  that would return all your measures in a table

select * from $SYSTEM.TMSCHEMA_MEASURES

 

@bcdobbs 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

4 REPLIES 4
smpa01
Super User
Super User

@Anonymous  yes it is absolutely possible. If you are publishing the model in a workspace, you can write DMV queries  that would return all your measures in a table

select * from $SYSTEM.TMSCHEMA_MEASURES

 

@bcdobbs 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
amitchandak
Super User
Super User

@Anonymous , Not very clear.But seem like you need the list of measure DAX studio can help

 

https://ssbi-blog.de/blog/technical-topics-english/how-to-identify-measures-not-used-in-your-pbix-file/

https://community.powerbi.com/t5/Desktop/Find-the-unused-Measure-Data/td-p/1771801

 

 

In case you want to create a power bi table to organize your measure, then refer

https://www.youtube.com/watch?v=b9oDIL8nbu0

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi,

I was thinking like this:

I have a table called MEASURE_TABLE. In it I would have a varchar field where I would store a measure:

 

idMEASURE      dscMEASURE_NAME   dscMEASURE_COMMAND

-----------------------------------------------------------------------------------------------------------

1                       DB Date Difference     DATEDIFF(MIN(Calendario[Date]), MAX(Calendario[Date]),DAY) + 1

 

Would it be possible to convert the last 2 fields to a valid measure in Power BI?

It's kind of what you can do in T-SQL when you create a command based on a string and execute it.

Thanks.

 

 

@Anonymous , I doubt that. Power Bi cmdlets is there for automation, but I doubt they do not have add measure

you can check

https://docs.microsoft.com/en-us/powershell/power-bi/overview?view=powerbi-ps

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.