The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi experts,
I have a calculated month table to retrieve all months from my fact table.
Values in Month (Date Format) column is dynamic rolling 12-month ahead. I'd like to create a "Next 3 Month Indicator" column where: if Month (Date Format) <= MIN(Month (Date Format)) + 2 Month, then "Yes", else "No".
Could anyone please help me with the DAX? Thanks in advanced.
Solved! Go to Solution.
Hi @Winniethewinner ,
There are many ways to achieve your required output, but I am wondering the reason why your calendar table has to be in month granularity. I would normally create a calendar table with day granularity and create relationship with the fact table.
Calendar =
ADDCOLUMNS (
CALENDAR ( DATE ( 2024, 01, 01 ), DATE ( 2024, 12, 31 ) ),
"yyyy-mm", FORMAT ( [Date], "yyyy-mm" ),
"Next 3 months",
IF ( [Date] >= TODAY () && [Date] <= EOMONTH ( TODAY (), 3 ), "Yes", "No" )
)
Then you can summarize the calendar table using the month granularity as shown below:
I attach a pbix file as an example.
Best regards,
Hi @Winniethewinner ,
There are many ways to achieve your required output, but I am wondering the reason why your calendar table has to be in month granularity. I would normally create a calendar table with day granularity and create relationship with the fact table.
Calendar =
ADDCOLUMNS (
CALENDAR ( DATE ( 2024, 01, 01 ), DATE ( 2024, 12, 31 ) ),
"yyyy-mm", FORMAT ( [Date], "yyyy-mm" ),
"Next 3 months",
IF ( [Date] >= TODAY () && [Date] <= EOMONTH ( TODAY (), 3 ), "Yes", "No" )
)
Then you can summarize the calendar table using the month granularity as shown below:
I attach a pbix file as an example.
Best regards,
I took the latter part of formula and added a column, it works, thanks!
IF ( [Date] >= TODAY () && [Date] <= EOMONTH ( TODAY (), 3 ), "Yes", "No" )
The reason my calendar table in month granularity is because my fact table is aggregation by month. Also, my calendar table is calculated based on fact table as it is always changing.
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
32 | |
14 | |
10 | |
10 | |
9 |