cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
ooctaviano
Frequent Visitor

% for measure

Hello

 

I have the following measure

 

Requested cost = CALCULATE(SUMX(Table,[Cost]*[Requested qty]))
 
The following measure looks in a table like this
 
ooctaviano_0-1624488063539.png

 

I just need adding the percetage to each of the items. In case of the order number the percetage should be 100%

 

Please advise

 

Omar Octaviano

1 REPLY 1
daxer-almighty
Solution Sage
Solution Sage

@ooctaviano 

 

Writing DAX code needs to follow some generally accepted rules (just like in Python) so that people are able to tell at a glance whether they see a measure or a column. From your code it's not at all clear whether [Cost] and [Requested qty] are measures or columns in the table.

 

I'd suggest reading this guide on DAX formatting rules: Rules for DAX Code Formatting - SQLBI and sticking to them religiously.

 

Please bear in mind that if you iterate a fact table through an aggregator (like SUMX, for instance) you should never invoke a measure in the second argument unless you want to 1) have a model that's agonizingly slow and/or 2) produce wrong figures in a somewhat random fashion. What's worse, you won't be even able to spot the problem.

 

Also, I anticipate that your model is a single-table one (if not, then ignore this remark but still watch the video). If you want to see what really bad things can happen in this case, please watch this video: (1) Auto-exist on clusters or numbers - Unplugged #22 - YouTube

 

To be able to write a good formula for what you want, you have to show the model and also say what you want to see at the grand total.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors