Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hola,
Quiero contar cuantos clientes distintos hay en la tabla de facturas, albaranes o pedidos. De tal manera que independiente del numero de veces que aparece, me cuente un cliente. Se me ha ocurrido esto pero ¿Hay alguna manera más efectiva de hacerlo?
#Clientes con ventas =
VAR _EsteMes = MAX( [MonthKey] )
VAR _TablaDaily =
UNION(
Filter(
Values( [Id_sk_Clientes] ),
MAx([Monthkey])=_EsteMes),
Filter(
Values( [Id_sk_ClientesAlbaranes] ),
Max([Monthkey])=_EsteMes),
Filter(
Values( [Id_sk_ClientesPedidos] ),
MAx([MonthKey])=_EsteMes)
)
Return
COUNTROWS(SUMMARIZE(_TablaDaily, [Id_sk_Clientes] ))
#Clientes with sales =
WERE _EsteMes = MAX('Date'[MonthKey])
WERE _TablaDaily =
UNION(
Filter(
Values('Sales Invoices'[Id_sk_Clientes]),
MAx('Date'[Monthkey])=_EsteMes),
Filter(
Values('Sales Delivery Notes'[Id_sk_Clientes]),
Max('Date'[Monthkey])=_EsteMes),
Filter(
Values('Sell Orders'[Id_sk_Clientes]),
MAx('Date'[MonthKey])=_EsteMes)
)
Return
DistinctCount(_TablaDaily[Id_sk_Clientes])
Hi, @Syndicate_Admin
The reason for the error message is that the DAX measure can only return a single value, not the entire table. You are trying to return the entire table, which is not allowed. The above DAX using Distinctcount is my idea, can you provide some sample data or PBIX files, and please do not divulge your privacy information.
Best Regards
Yongkang Hua
Hi, @Syndicate_Admin
Maybe you can try the DISTINCTCOUNT function instead of COUNTROWS and SUMMARIZE, like this:
#Clientes con ventas =
VAR _EsteMes = MAX( [MonthKey] )
VAR _TablaDaily =
UNION(
Filter(
Values( [Id_sk_Clientes] ),
MAx([Monthkey])=_EsteMes),
Filter(
Values( [Id_sk_ClientesAlbaranes] ),
Max([Monthkey])=_EsteMes),
Filter(
Values( [Id_sk_ClientesPedidos] ),
MAx([MonthKey])=_EsteMes)
)
Return
DISTINCTCOUNT(_TablaDaily[Id_sk_Clientes])
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You would use EXCEPT to find the difference.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
User | Count |
---|---|
107 | |
89 | |
81 | |
76 | |
73 |
User | Count |
---|---|
112 | |
104 | |
96 | |
74 | |
66 |