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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Simple DAX formula to state the Goal from a table

capture1.JPGcapture2.JPG

I am new to DAX so my apologies for the basic question....

How can I get the Goal % column to reflect what I have listed in my table?
My table is for Customer and what I think the Goal % should be.

The Customer fields are connected in my Model.

I just want the Goal % to say what I have in my table (for each Customer).

Seems like it should be very simple but I cannot figure it out

 

 

3 REPLIES 3
kentyler
Solution Sage
Solution Sage

You did not post any actual data samples... so it's hard to really say.

but looking at your DAX measure my guess would be that when you take the AVG of the Goal table it is already being filtered by the external context... so you do not get the number you think you should get.

You probably need to use CALCULATE with the ALL function to restore the full table to do the average over.

Goal % = CALCULATE(AVERAGE('Table'[Goal])/100,ALL(Table))
depending on whether you need to remove the filter context for the whole table, or possible just for the Goal column, in which case it would be ALL(Table[Goal])

I'm a personal Power Bi Trainer I learn something every time I answer a question

The Golden Rules for Power BI

  1. Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
  2. Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
  3. Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Thank you so much for the reply!  I am not sure the AVERAGE function is what I need.

Capture4.JPG

I have the Goal % (for each customer) in a table.  I am looking for a way to get the straight number from the table into my visual.

 

Right now, the only options are Sum, Avg, Min, Max, Count, etc.

 

capture3.JPG

I just want the exact value but cannot figure out how to do that.

 

capture2.JPG

If the percentage values are in a table, then you should be able to write a measure.

As you have discovered measures cannot address a column value directly, because a measure does not have a specific "row context"

But if you place your measure in the table control, then the table (or matrix) will generate a filter context that changes for each row.

You can address that filter context to get the percentage for the row

Percent Value = SELECTEDVALUE(mytable[percentColumn])

or something like that should work

SELECTEDVALUE

  • 12/09/2018
  • 2 minutes to read
      •  
     
    •  

Returns the value when the context for columnName has been filtered down to one distinct value only. Otherwise returns alternateResult.

 
SELECTEDVALUE(<columnName>[, <alternateResult>])   

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors