Forum Discussion
Creating a new table from 2 others with a calculation
- Anonymous6 years ago
PatrickByGecko - You could create the following Calculated Table in DAX:
New = ADDCOLUMNS(Dates, "Nbr Male", COUNTROWS( FILTER( ALL(Workers), Workers[DateEntry] <= Dates[Date] && Workers[Sex] = "male" ) ), "Nbr Female", COUNTROWS( FILTER( ALL(Workers), Workers[DateEntry] <= Dates[Date] && Workers[Sex] = "female" ) ) )
PatrickByGecko - I think there is a problem with "ors" (||) and "ands" (&&). Please use the parentheses as they were in the measure I sent. Mixing "Ands" and "Ors" can produce unpredictable/problmatic logic.
The logic is:
Category = "<Some Category>"
AND
(
Worker Date = Date
OR
(
Worker Date is Prior to Begin Date
AND
Date = Begin Date
)
)
I did put some "(" the best I can, but only the first row is completed I mean when date=_DateBegin.
- Anonymous6 years agoNot applicable
PatrickByGecko - The problem is the column [DATE ENTREEE] contains Date + Time information. Therefore, it does not contain exact matches with the date table, which is Date only.
You could create a new column like this:
Date2 = INT(Collaborateurs2[DATE ENTREEE])Then use the new column in the Relationship and in the DAX, instead of [DATE ENTREEE]
I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos. - Anonymous6 years agoNot applicable
PatrickByGecko - Can you please check some particular dates that are known to have data and let me know whether they have data for the Measure?
- PatrickByGecko6 years agoHelper V
Yes there is data as you can see. The problem is somewhere else because at this time I get no value at all for each counter...
😞
There is no value in the counters even when there is no test on "category"..
- Anonymous6 years agoNot applicable
PatrickByGecko - Would it be possible to share your pbix file?
- PatrickByGecko6 years agoHelper V
Of course. I did an extract and the effect is the same.
Here it is => https://we.tl/t-9QoLPrU5KF
- PatrickByGecko6 years agoHelper V
It is working Thanks a lot Natel.
Patrick.