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, @jesly_ajin
I am not quite sure if the below measure suits your requirement because it was quite difficult for me to understand your data model.
Please try to test it on the blank page.
On the blank page, create a slicer that uses a calendar-table, that is disconnected to the table.
weekdayscount(new) =
VAR newtable =
ADDCOLUMNS (
InEightProjEquipmentStagingTable,
"@dayscount",
CALCULATE (
COUNTROWS ( 'calendar' ),
DATESBETWEEN (
'calendar'[Calendar_date],
SELECTEDVALUE ( InEightProjEquipmentStagingTable[FROMDATE] ),
SELECTEDVALUE ( InEightProjEquipmentStagingTable[TODATE] )
),
'calendar'[Week_day_name] <> "Saturday"
&& 'calendar'[Week_day_name] <> "Sunday"
)
)
RETURN
SUMX ( newtable, [@dayscount] )
If the above is not working, please try to change the [FROMDATE] and [TODATE] columns to Date Type, not date & time type.
I hope it works.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @jesly_ajin
I am not sure about how your data model look like, but in my cases, I generally have custom date table, and I normally write below DAX measure.
I have DayOfWeek column in my date-table. (Sunday = 0, Saturday = 6)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thanks for response.
I have 2 measures [CalcFromDate] & [CalcToDate] :-
Hi, @jesly_ajin
I am not quite sure if the below measure suits your requirement because it was quite difficult for me to understand your data model.
Please try to test it on the blank page.
On the blank page, create a slicer that uses a calendar-table, that is disconnected to the table.
weekdayscount(new) =
VAR newtable =
ADDCOLUMNS (
InEightProjEquipmentStagingTable,
"@dayscount",
CALCULATE (
COUNTROWS ( 'calendar' ),
DATESBETWEEN (
'calendar'[Calendar_date],
SELECTEDVALUE ( InEightProjEquipmentStagingTable[FROMDATE] ),
SELECTEDVALUE ( InEightProjEquipmentStagingTable[TODATE] )
),
'calendar'[Week_day_name] <> "Saturday"
&& 'calendar'[Week_day_name] <> "Sunday"
)
)
RETURN
SUMX ( newtable, [@dayscount] )
If the above is not working, please try to change the [FROMDATE] and [TODATE] columns to Date Type, not date & time type.
I hope it works.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, @jesly_ajin
Thank you for your question.
If it is OK with you, can I see your sample pbix file?
It is quite difficult for me to come up with a desirable solution without seeing the data model.
By only seeing the first two measures, I think those are referencing the date-table to calculate the days-count between the slicer. -> is it not connected?
If it is not connected, I think it is not so easy to put the condition (noweeken) that comes from the date-table.
If it is OK, please share the sample pbix file, then I can try to solve it.
Thank you very much.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
it is not connected. It is like calculating the difference between 2 independent dates.
Kindly send me your email id - i can do the wetransfer of the file to you.
I sent my email address via message.
please check your message inbox.
Thank you.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thanks a lot for the help and support sir.
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 |
---|---|
106 | |
94 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |