The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
I have a table with columns Sale_Date and Post_Date. I need to calculate the business days between Sale_Date and Post_Date.
I have a caculated column to calculate the business days, but I need to convert it to M so that I can create a column inPower Query.
CountofBusinessdays = COUNTX ( Calendar, Calendar[Date] > 'Table'[Sale_Date]
&& Calendar, Calendar[Date] <= 'Table'[Post_Date]
&& Calendar[IsBusinessday] = 1 ) ,
Calendar[Date] )
How to convert the abow DAX to M?
Thank you so much!
Hi , @Harry_Tran
According to your description, you wan to convert the dax to M code.
This is my test data:
We can click "Custom Column" in the 'Table' and enter this:
Table.RowCount(Table.SelectRows(Calendar,(x)=>x[Date]>=[Sale_Date] and x[Date]<=[Post_Date] and x[IsBusinessday]=1))
Then we can get the result:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
User | Count |
---|---|
57 | |
54 | |
53 | |
48 | |
30 |
User | Count |
---|---|
177 | |
88 | |
70 | |
48 | |
48 |