We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hey folks,
I'm trying to create a column like the one to the right in the picture, where every line is a project and I need to add up everyone's work days YTD. If say, two projects have the same month and same person then only one would need to count to the YTD workdays. Any idea how to do this?
Thanks,
Pierre
Solved! Go to Solution.
Hello Pierre,
There could be better method but this DAX also works if you have a unique field the data set:
Distinct WD =
IF (
CALCULATE (
COUNTROWS ( Table1 ),
ALLEXCEPT ( Table1, Table1[Name], Table1[Date] ),
EARLIER ( Table1[Id] ) >= Table1[Id]
)
= 1,
[This Month],
0
)
Thanks,
Prakash
Hello Pierre,
The AllEXCEPT gives the all rows of the table (for each Name and Date pair) and earlier gives the current row.
When we count all Id where Name and Date is equal AND current Id is >= all Id, we are left with the correct count.
The >= might be confusing. Please see below MSDN link where earlier has been described in detail:
https://msdn.microsoft.com/en-us/library/ee634551.aspx
Thanks,
Prakash
Hello Pierre,
There could be better method but this DAX also works if you have a unique field the data set:
Distinct WD =
IF (
CALCULATE (
COUNTROWS ( Table1 ),
ALLEXCEPT ( Table1, Table1[Name], Table1[Date] ),
EARLIER ( Table1[Id] ) >= Table1[Id]
)
= 1,
[This Month],
0
)
Thanks,
Prakash
Hey Prakash could you explain to me how the Earlier function works in this scenario?
Thanks,
Pierre
Hello Pierre,
The AllEXCEPT gives the all rows of the table (for each Name and Date pair) and earlier gives the current row.
When we count all Id where Name and Date is equal AND current Id is >= all Id, we are left with the correct count.
The >= might be confusing. Please see below MSDN link where earlier has been described in detail:
https://msdn.microsoft.com/en-us/library/ee634551.aspx
Thanks,
Prakash
Awesome thanks Prakash!
Thanks man you're a legend
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |