Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
ozne99
Frequent Visitor

Using Max Date of Separate Table in Column Formula

Hi all,

 

I have a budget dataset with one date column, which I am trying to filter.

 

I have two separate unjoined tables for Date to used to calculate two separate YTD amounts in the budget dataset, so I can compare YTD1 vs YTD2 based on the Date1 and Date2 slicers. I did not join the tables because I did not want the dates to affect the YTD calculations. That works fine, but where I am stuck is that I want to have a column to identify when the Budget Date is between the selected Date1 and Date2. I tried to use the following formula in a column:

 

IF(AND(BUDGETDATE <= MAX(DATE1), BUDGETDATE >= MAX(DATE2), 0,1)

 

The problem is that the MAX function takes into account the latest date in each of the Date tables, instead of what is selected in the slicer, so it always comes up as 1.Capture.PNG

 

I feel like I might be overcomplicating this issue, but have been stuck on this for awhile. Any assistance is much appreciated!

 

Thanks in advance!

1 ACCEPTED SOLUTION
ozne99
Frequent Visitor

Figured it out. Created a SUMX formula to force the calculations to occur at the row level and applied a filter to remove 0 from the visual

 

Formula: SUMX(BUDGET, IF(AND(BUDGETDATE <= MAX(DATE1), BUDGET DATE >= MAX(DATE2)),1,0)

View solution in original post

3 REPLIES 3
ozne99
Frequent Visitor

Figured it out. Created a SUMX formula to force the calculations to occur at the row level and applied a filter to remove 0 from the visual

 

Formula: SUMX(BUDGET, IF(AND(BUDGETDATE <= MAX(DATE1), BUDGET DATE >= MAX(DATE2)),1,0)

lbendlin
Super User
Super User

"what is selected in the slicer"  - this immediately disqualifies the request as you cannot create columns from measures.

 

Have a look at the FILTERS() or VALUES() functions if you want to do this with measures.

Thanks the tip; I've tried to use various combinations of VALUES() and FILTERS() early on, but not sure how to incorporate it into my need.

 

Ultimately, I want the column to flag dates less than the slicer selection, but not sure how to build that out. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.