Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I am trying to perform a Distinctount with range as condition across two tables. However, since I have no relations between the tables I am having trouble finding a solution. An example below. I want to create the "Unique in range".
Any ideas to help me find a solution would be greatly appreciated.
Solved! Go to Solution.
HI @MagnusJ,
You can use below formula to check the matched unique product count:
Unique Count = CALCULATE(COUNTROWS(VALUES('Product'[Product])),FILTER(ALL('Product'),[Xvalue] in GENERATESERIES([MinX],[MaxX],1) && [Yvalue] in GENERATESERIES([MinY],[MaxY],1)))
Result
Notice: I named table1 to range, table2 to product.
Regads,
Xiaoxin Sheng
HI @MagnusJ,
You can use below formula to check the matched unique product count:
Unique Count = CALCULATE(COUNTROWS(VALUES('Product'[Product])),FILTER(ALL('Product'),[Xvalue] in GENERATESERIES([MinX],[MaxX],1) && [Yvalue] in GENERATESERIES([MinY],[MaxY],1)))
Result
Notice: I named table1 to range, table2 to product.
Regads,
Xiaoxin Sheng
Thanks for the solution! I am still checking if this is the best one or if I need to combine tables instead.
Hello,
Use this formula to define calculated column
Unique in Range=CALCULATE(DISTINCTCOUNT(Table2[Product]);
Table2[Xvalue]<=EARLIER(Table1[MaxX]) && Table2[Xvalue] >= EARLIER(Table1[MinX]);
Table2[Yvalue] <= EARLIER(Table1[MaxY]) && Table2[Yvalue] >= EARLIER(Table1[MinY])
)
Thank you for the proposed solution! I would however like to do it without EARLIER as I have a large amount of data. Any ideas on a workaround?
Unfortunatelly, not any ideas on a workaround.
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 |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 18 |
| User | Count |
|---|---|
| 68 | |
| 67 | |
| 33 | |
| 31 | |
| 29 |