Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 🙂
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
9 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
11 | |
11 | |
10 | |
6 |