Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi
I have a table that contains the following columns
Location, Date, CheckNotCompleted. WeekNumber and Year
My CheckNotCompleted column contains a Yes or No response
I need DAX to create a new column that will look at the CheckNotCompleted column for each week number and Location and if the week for that location has a Yes response in it then return Yes for all of the relavent week days for that week, if the column doesn't have a Yes response for that week then the reponse would be No..
Is this possible ??
Solved! Go to Solution.
Hi @snoozee ,
Based on the screenshot you provided, you need to change the code slightly as follows.
Weekly Check =
VAR CurrentLocation = 'Table'[Location]
VAR Cnt =
CALCULATE (
COUNT ( 'Table'[CheckNotCompleted] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[WeekNumber] ),
'Table'[CheckNotCompleted] = "Yes"
&& 'Table'[Location] = CurrentLocation
)
)
RETURN
IF ( Cnt >= 1, "Y", "N" )
Result is as below.
Hope that works for you.
For further details,please find attachment.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @snoozee ,
@Jihwan_Kim nice method! Thank you, for your helpful and quick response.
And you can also consider using the following code to create a Calculated column.
Weekly Check =
VAR CurrentLocation = 'Table'[Location]
VAR Cnt =
CALCULATE (
COUNT ( 'Table'[CheckNotCompleted] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[WeekNumber] ),
'Table'[CheckNotCompleted] = "Y"
&& 'Table'[Location] = CurrentLocation
)
)
RETURN
IF ( Cnt >= 1, "Y", "N" )
My Sample:
Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for getting back to me yet unfortunately it's not working as all of the results are 'N' 😣
The example below should be displaying 'Y' for all of these dates as a check was completed within the week.
Hi @snoozee ,
Based on the screenshot you provided, you need to change the code slightly as follows.
Weekly Check =
VAR CurrentLocation = 'Table'[Location]
VAR Cnt =
CALCULATE (
COUNT ( 'Table'[CheckNotCompleted] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[WeekNumber] ),
'Table'[CheckNotCompleted] = "Yes"
&& 'Table'[Location] = CurrentLocation
)
)
RETURN
IF ( Cnt >= 1, "Y", "N" )
Result is as below.
Hope that works for you.
For further details,please find attachment.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-weiyan1-msft Thank you so much for this and my apoligies as my brain obvioulsy wasn't working yesterday as i should have picked up the 'Y' rather the 'Yes' 😊
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
WINDOW function (DAX) - DAX | Microsoft Learn
Expected result CC =
VAR _t =
FILTER (
WINDOW (
1,
ABS,
-1,
ABS,
Data,
ORDERBY ( Data[Date], ASC ),
,
PARTITIONBY ( Data[Location], Data[Year], Data[Week Number] ),
MATCHBY ( Data[Location], Data[Date] )
),
Data[CheckNotCompleted] = "Y"
)
RETURN
IF ( COUNTROWS ( _t ) >= 1, "Y", "N" )
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.
@Jihwan_Kim Thank you so much for replying so quickly !!
Unfortunately this doesn't work for me as i'm getting an error of - Cannot find name 'Window' , 'Window' is not a function, Parameter is not the correct type.
This is probably related to the version of Power Bi I'm using - May 2021 and unfortunately i can't update it as it's controlled by my work 😞
This is also the reason why i can't open your attachment either.
Is there any other option available ?
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
21 | |
20 | |
19 | |
13 | |
12 |
User | Count |
---|---|
42 | |
28 | |
23 | |
22 | |
22 |