Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I'll just go ahead with an example of what I need to do to illustrate what I want.
| Line ID | Line's Constant |
| 1 | 0.23 |
| 2 | 0.15 |
| 3 | 0.325 |
| 4 | 0.14 |
| 5 | 0.314 |
| Line ID | Stop Reason |
| 1 | Reason A |
| 2 | Reason B |
| 3 | Reason C |
| 4 | Reason D |
| 5 | Reason X |
| 1 | Reason Y |
| 5 | Reason Z |
| 4 | Reason A |
| 2 | Reason B |
| 5 | Reason C |
| 1 | Reason D |
| 4 | Reason Y |
| 3 | Reason A |
| 3 | Reason Z |
| 1 | Reason A |
| 2 | Reason B |
I want to represent "Line ID" VS the value I get from multiplying (The count of each "Stop Reason" for each Line ID * the Line's Constant"
The only problem is, I don't want to to do it using the following or a similar count if function.
Count of Stop Reason = COUNTROWS(
FILTER(
RELATEDTABLE('Raw Data'),
'Raw Data'[Stop Reason] = "Reason Y"
)
)
and so on, because I have more than 100 unique values in the "Stop reason" coulmn.
Is there a smarter why to do that?
Thanks a lot.
Solved! Go to Solution.
@NaderSaeed
Sheet7 is the table with constant, Shee8 is the table with stop reason.
Result =
var count_= CALCULATE(COUNTROWS(Sheet8),ALLEXCEPT(Sheet8,Sheet8[Line ID],Sheet8[Stop Reason]))
var constant = CALCULATE(MAX(Sheet7[Line's Constant]),FILTER(Sheet8,Sheet8[Line ID]=RELATED(Sheet7[Line ID])))
Return count_*constant
Paul Zheng
Don't forget to hit THUMBS UP and mark it as a solution if it helps you!
@NaderSaeed
Sheet7 is the table with constant, Shee8 is the table with stop reason.
Result =
var count_= CALCULATE(COUNTROWS(Sheet8),ALLEXCEPT(Sheet8,Sheet8[Line ID],Sheet8[Stop Reason]))
var constant = CALCULATE(MAX(Sheet7[Line's Constant]),FILTER(Sheet8,Sheet8[Line ID]=RELATED(Sheet7[Line ID])))
Return count_*constant
Paul Zheng
Don't forget to hit THUMBS UP and mark it as a solution if it helps you!
Brilliant. Exactly what I wanted!
Thank you so much Paul. 🙂
Can you share the PBIX?
Thanks for replying.
Unfortunately I can't, as its data is confidential.
But the example I gave roughly illustrates what I need to do.
For example,
For Line 1, Reason Z.
I want to multiply (0.23 * Count of Reason Z for Line 1), and do the same for each Line ID vs each Stop Reason.
i.e. Line 1, Reason A, Line 1, Reason X, and so on.
And then represent the data as follows, where the numbers on the graph are the values I get after the aforementioned multiplication for each line and reason.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 40 | |
| 36 | |
| 20 | |
| 18 |
| User | Count |
|---|---|
| 74 | |
| 72 | |
| 38 | |
| 35 | |
| 26 |