Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I have found 2 (partial) solutions to my problem but I don't like them.... Hope I can find some help 🙂
I have a big database (hundreds of thousands of lines) corresponding to articles received in a warehouse. To simplify it, let's say that I juste have those colums :
- Date of receiving
- reference number of the receiving
- Article
NB1 :
1 Receiving reference usually concerns many articles (let's imagine it is a truck delivering many articles)
NB2:
I can have more than once the same line repeating, it means that I have received more than once the same article with the same receiving reference.
My goal is to create a column in my database calculating, for each line, the distinct number of receiving references received in the same month for the same article.
Track 1 :
This formula works but it is really really realy slow and I want to avoid it.
Solved! Go to Solution.
Hi @sebastienke ,
What about this?
What_I_want 2 =
CALCULATE (
COUNTROWS ( DISTINCT ( 'Table'[reference number of the receiving] ) ),
ALLEXCEPT ( 'Table', 'Table'[Article], 'Table'[Month] )
)
I used COUNTROWS and DISTINCT instead of DISTINCTCOUNT, referring to this blog: Analyzing the performance of DISTINCTCOUNT in DAX.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sebastienke ,
What about this?
What_I_want 2 =
CALCULATE (
COUNTROWS ( DISTINCT ( 'Table'[reference number of the receiving] ) ),
ALLEXCEPT ( 'Table', 'Table'[Article], 'Table'[Month] )
)
I used COUNTROWS and DISTINCT instead of DISTINCTCOUNT, referring to this blog: Analyzing the performance of DISTINCTCOUNT in DAX.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot @Icey , it works.
However, I'm not sure to understand the logical of ALLEXCEPT.
Its description is :
Removes all context filters in the table except filters that have been applied to the specified columns.
but I am not sure to understand the "filter that have been applied". Does the fact to write
ALLEXCEPT ( 'Table', 'Table'[Article], 'Table'[Month] )
mean that Power BI will consider for each line of my database the related "article" and the "month" as value for the filter ?
Actually I also have found another solution by improving my track number 2. After having created antoher table with :
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |