The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now
I have a table as defined below. The DAX column is the column I am trying to create.
I want to have the DAX column flag each row with a yes or no.
Conditions for a yes
Condition for no
How would I write the DAX for this flag? I've tried to think of a way to do it with a nested IF but I can't seem to figure it out. Thanks.
Name | Date | Location | DAX COLUMN |
Bob | Monday, October 1, 2018 | A | yes |
Bob | Monday, January 1, 2018 | A | yes |
Bob | Thursday, March 1, 2018 | A | yes |
Jane | Monday, January 1, 2018 | A | no |
Jane | Thursday, March 1, 2018 | B | yes |
Jane | Monday, October 1, 2018 | B | yes |
Mike | Monday, January 1, 2018 | B | no |
Jerry | Monday, October 1, 2018 | C | yes |
Solved! Go to Solution.
Hi @tasmiaa
Try this for your column. It assumes that no rows have a blank() at Location:
DAXColumn = VAR _OctoberLocation = LOOKUPVALUE ( Table1[Location], Table1[Date], DATE ( 2018, 10, 1 ), Table1[Name], Table1[Name] ) RETURN IF ( Table1[Location] = _OctoberLocation, "Yes", "No" )
Hi @tasmiaa
Try this for your column. It assumes that no rows have a blank() at Location:
DAXColumn = VAR _OctoberLocation = LOOKUPVALUE ( Table1[Location], Table1[Date], DATE ( 2018, 10, 1 ), Table1[Name], Table1[Name] ) RETURN IF ( Table1[Location] = _OctoberLocation, "Yes", "No" )
Thank you! That worked wonderfully! I didn't even know I could make a var.
Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.
User | Count |
---|---|
158 | |
109 | |
96 | |
83 | |
75 |
User | Count |
---|---|
154 | |
137 | |
131 | |
81 | |
62 |