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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
fleetingImage
New Member

Create multiple measure at once from text file

Hi guys,

 

I've been searching the web and also the community for a way to generate multiple measures at once.  Either within Power BI desktop or by uploading a file with the predefined formulas.

 

I found these links, but this isn't exactly what I'm looking for:

https://community.powerbi.com/t5/Desktop/create-multiple-measures-at-once/m-p/171447?search-action-i...

 

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Creating-Multiple-Measures-at-once/m-p/138038...

 

The problem is as follows.  I have around 50 formulas that then will be multiplied 4x each so I'll end up with ~200.  As an example:

 

gSales = CALCULATE(SUM(data[Values]),data[Metric]="gross sales")

gSalesActual = CALCULATE([gSales],dimBudget[budgetDesc]="Actual")

gSalesPlan = CALCULATE([gSales],dimBudget[budgetDesc]="Plan")

gSalesPriorYear = CALCULATE([gSales],dimBudget[budgetDesc]="PY")

 

So my list of "base" metrics (like gross sales in the example) is about 50 of them.  Then I have to derive new ones (as in the example)

 

Doing that one by one is exhausting.  Is there a way to upload a file or a way to define them all at once in Power BI(copy/paste) ?

 

Thanks in advance!

 

 

 

 

1 ACCEPTED SOLUTION
edhans
Super User
Super User

You want to install Tabular Editor and use the Scripting function. This is a link to some sample scripts on github. You can modify to suit your needs for your specific measures. There is also a 4 part YouTube series on getting started with Tabular Editor that is by the author of the app. Part 1 is here, and the rest are in the playlist.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

You want to install Tabular Editor and use the Scripting function. This is a link to some sample scripts on github. You can modify to suit your needs for your specific measures. There is also a 4 part YouTube series on getting started with Tabular Editor that is by the author of the app. Part 1 is here, and the rest are in the playlist.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.