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.
I have the below model:
And when I want to display revenue by segment, it just gives me the totals:
(The above is wrong; it should roughly be half for A and half for B, but it just displays totals 3 times...)
Is there a function in dax I have to use to enforce this segmentation?? (the segmentation comes from ClientType, which is not directly related, but through Client.
Solved! Go to Solution.
@Anonymous You could try:
CALCULATE(
SUM('Revenue'[Revenue]),
TREATAS(DISTINCT('ClientType'[ClientNo]),'Client'[ClientNo])
)
How many records are in each table? Also, the relationships shown in your image seem to be impossible. You have multiple paths between the Client table and the Revenue table and so there is a relationship that would need to be inactive.
thanks for your answer, unfortunately I get:
@Anonymous You could try:
CALCULATE(
SUM('Revenue'[Revenue]),
TREATAS(DISTINCT('ClientType'[ClientNo]),'Client'[ClientNo])
)
How many records are in each table? Also, the relationships shown in your image seem to be impossible. You have multiple paths between the Client table and the Revenue table and so there is a relationship that would need to be inactive.
@Anonymous Well, you could use a technique I call DAX Table Hopping:
Measure =
VAR __Clients = DISTINCT('ClientType'[ClientNo])
VAR __KeyCustomers = DISTINCT(SELECTCOLUMNS(FILTER('Client',[ClientNo] IN __Clients),"__Key_Customer",[Key_Customer]))
RETURN
SUMX(FILTER('Revenue',[Key_Customer] IN __KeyCustomers),[Revenue])
User | Count |
---|---|
25 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |