Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
While creating a column to use as a conditional formating field, I have encountered an issue we cannot explain.
I backed off the conditional set when I was verifying my VAR steps to just look at the date conversion. (We ultimately want a date to show a red background in a visual when a contract is within 3 months of expiring.)
The DAX is simply:
Solved! Go to Solution.
I created a small sample of dates to try an re-create the issue. And I was successful in getting some blanks and some correct values. I changed the endminus3 measure to return the date 12/31/9999 when blank to troubleshoot if it was a "blanks" issue or a date issue. The blanks were not the problem, so it is something with the dates. I looked at the dateadd function documentation and found
The result table includes only dates that exist in the dates column.
That describe what I was seeing in my small data set. I wonder if it applies to your situation.
To get around this I added a column in Power Query to do the math there and it works just fine.
= Table.AddColumn(#"PreviousStep", "endminus3", each Date.AddMonths([Date], -3))
is what I added in Power Query
Proud to be a Super User! | |
I created a small sample of dates to try an re-create the issue. And I was successful in getting some blanks and some correct values. I changed the endminus3 measure to return the date 12/31/9999 when blank to troubleshoot if it was a "blanks" issue or a date issue. The blanks were not the problem, so it is something with the dates. I looked at the dateadd function documentation and found
The result table includes only dates that exist in the dates column.
That describe what I was seeing in my small data set. I wonder if it applies to your situation.
To get around this I added a column in Power Query to do the math there and it works just fine.
= Table.AddColumn(#"PreviousStep", "endminus3", each Date.AddMonths([Date], -3))
is what I added in Power Query
Proud to be a Super User! | |
You hit it spot on!
That was the limiting issue. I need to remember that one for the future.
Kudos and Solution Acceptance given.
Thanks again,
Trent
Thanks for taking a look. Since it has the reference date in the 'Contract End' column, I would not think it an issue. I will go back and see if that is indeed the case.
I do have a date table which does NOT have a direct relationship to this table but is linked through another table. I had tried creating an inactive direct relationship and adding USERELATIONSHIP to the DAX but it did not seem to make any difference.
I will update on the finding from your suggestion.
Trent
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |