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.
Hello everyone!
I am having the following situation:
I have a FACT table called "SalesLines" which is connected to DIM "Invoiceheader"
SalesLines has multiple lines per Sales Order
InvoiceHeader as a DIM has just one Sales Order per line.
I need a dax measure to know the count of Sales Orders.
If i do it over the FACT, I get a huge number because when a Sales Order has 4 lines is counting as 4. If I do it over the DIM table, the visual has low performance and takes 2 min to display.
The closest that i have been is here:
Solved! Go to Solution.
Hi @GermanTersoglio
If the column exists in the fact table the
= DISTINCTCOUNT ( 'SalesLines'[SalesId] )
If not then
=
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
SalesLines,
"@SalesID", RELATED ( 'Invoice Header'[SalesId] )
)
)
)
Hi @GermanTersoglio
If the column exists in the fact table the
= DISTINCTCOUNT ( 'SalesLines'[SalesId] )
If not then
=
COUNTROWS (
DISTINCT (
SELECTCOLUMNS (
SalesLines,
"@SalesID", RELATED ( 'Invoice Header'[SalesId] )
)
)
)
Hi Tamerj,
I was facing my measure in the wrong way.
You solution works perfectly. I really appreciate your help.
Thanks for sharing your knowledge 🙂
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
8 | |
8 |