The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Good Day Professionals,
I’ve been trying to find a solution on how to reference a value of the measure from one visual (table) into another.
In my example, I have a transaction table with Rep, Customer, Item, Actual Price, and Target Price. I have a measure (Rate %) defined as DIVIDE(Actual Price M, Target Price M). “Actual Price M” and “Target Price M” are measures also.
In my table (visual) “Customer – Rate” I can see Rate by a Customer. I would like to use result of this visual, and create another visual (ideally a histogram), which will perform count of Customers by Rate, which falls into the range of “Rate Ranges” table. Ultimately, Range 50% – 100% should have count of 4, Range 100% - 150% should have count of 3, etc.
I’m attaching a link to the model, perhaps it would be easier to see.
Thank you in advance for your recommendation.
https://drive.google.com/file/d/1140QrqCVsFNs509uxuNCjKp7PJCWd-Kv/view?usp=sharing
Best Regards,
Sam
Solved! Go to Solution.
Create a column chart with Range Name on the x-axis and put a measure that counts the customers in that range in the Values field.
I defined this measure as follows:
CustCont =
VAR MinVal = SELECTEDVALUE ( 'Rate Ranges'[Value] )
VAR MaxVal = SELECTEDVALUE ( 'Rate Ranges'[Value2] )
RETURN
COUNTROWS ( FILTER ( Customer, [Rate] >= MinVal && [Rate] < MaxVal ) )
If you don't want to hide ranges with no customers, just add "+0" to the end of the measure so that it returns zero rather than blank for those cases.
Edit: Note that this does not actually reference any other visuals. See this recent thread for further discussion about that: https://community.powerbi.com/t5/Desktop/Is-It-Possible-to-Call-Refer-to-the-quot-Table-quot/m-p/193...
Thank you Alexis.
I guess DAX is the KING!!!
One follow up question that I have.... how/where can I specify sort order of the X Axes. Do I need to define a sequence in the "Rate Range" table?
Best Regards,
Sam
.... Actually I've found a solution to my own issue: "More Option" on the visual, and "Sort By" did the trick.
Create a column chart with Range Name on the x-axis and put a measure that counts the customers in that range in the Values field.
I defined this measure as follows:
CustCont =
VAR MinVal = SELECTEDVALUE ( 'Rate Ranges'[Value] )
VAR MaxVal = SELECTEDVALUE ( 'Rate Ranges'[Value2] )
RETURN
COUNTROWS ( FILTER ( Customer, [Rate] >= MinVal && [Rate] < MaxVal ) )
If you don't want to hide ranges with no customers, just add "+0" to the end of the measure so that it returns zero rather than blank for those cases.
Edit: Note that this does not actually reference any other visuals. See this recent thread for further discussion about that: https://community.powerbi.com/t5/Desktop/Is-It-Possible-to-Call-Refer-to-the-quot-Table-quot/m-p/193...
User | Count |
---|---|
87 | |
84 | |
36 | |
35 | |
32 |
User | Count |
---|---|
96 | |
75 | |
67 | |
52 | |
52 |