The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a calendar table and forecast revenue table. I have a measure that sums the revenue for each month. I am looking for a measure that I can plug into a card visal that will show the value for 2 months ahead from TODAY() date but only the value for that month.
here is sample data
Year | Month | Projected P&L |
2024 | January | $3,237,741.35 |
2024 | February | $3,398,590.01 |
2024 | March | $2,790,282.85 |
2024 | April | $3,062,162.02 |
2024 | May | $4,123,657.83 |
2024 | June | $4,697,926.64 |
2024 | July | $4,927,391.45 |
2024 | August | $3,057,279.58 |
2024 | September | $1,336,335.51 |
2024 | October | $1,224,933.53 |
2024 | November | $1,362,848.26 |
2024 | December | $1,374,464.65 |
Expected Results
Solved! Go to Solution.
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.
Expected result measure: =
VAR _expectedresultmonthend =
EOMONTH ( TODAY (), 2 )
RETURN
CALCULATE (
[Projected P&L:],
calendar_dim[Year-Month sort] = _expectedresultmonthend
)
OFFSET function (DAX) - DAX | Microsoft Learn
Expected result measure v2: =
VAR _thismonthend =
EOMONTH ( TODAY (), 0 )
VAR _t =
ADDCOLUMNS (
SUMMARIZE (
calendar_dim,
calendar_dim[Year-Month],
calendar_dim[Year-Month sort]
),
"@expectedresult",
CALCULATE (
[Projected P&L:],
OFFSET (
2,
ALL ( calendar_dim[Year-Month sort], calendar_dim[Year-Month] ),
ORDERBY ( calendar_dim[Year-Month sort], ASC )
)
)
)
RETURN
SUMMARIZE (
FILTER ( _t, calendar_dim[Year-Month sort] = _thismonthend ),
[@expectedresult]
)
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.
Expected result measure: =
VAR _expectedresultmonthend =
EOMONTH ( TODAY (), 2 )
RETURN
CALCULATE (
[Projected P&L:],
calendar_dim[Year-Month sort] = _expectedresultmonthend
)
OFFSET function (DAX) - DAX | Microsoft Learn
Expected result measure v2: =
VAR _thismonthend =
EOMONTH ( TODAY (), 0 )
VAR _t =
ADDCOLUMNS (
SUMMARIZE (
calendar_dim,
calendar_dim[Year-Month],
calendar_dim[Year-Month sort]
),
"@expectedresult",
CALCULATE (
[Projected P&L:],
OFFSET (
2,
ALL ( calendar_dim[Year-Month sort], calendar_dim[Year-Month] ),
ORDERBY ( calendar_dim[Year-Month sort], ASC )
)
)
)
RETURN
SUMMARIZE (
FILTER ( _t, calendar_dim[Year-Month sort] = _thismonthend ),
[@expectedresult]
)
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
10 | |
8 |