We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi There I have two calculated columns that show a 1 value for all dates that fall with a specified time period but I will like to change my calculations slightly to get a slightly different result. Many thanks.
Solved! Go to Solution.
(27/04/23-26/04/24)
pls try
(27/03/24-26/04/24)
pls try
Proud to be a Super User!
@AnalyticsWizard Thanks for your reply, this worked with some minor tweaks only because I changed my mind on how many months I wanted to see, thanks for explaining it!
(27/04/23-26/04/24)
pls try
(27/03/24-26/04/24)
pls try
Proud to be a Super User!
This works as well, thank you!
you are welcome
Proud to be a Super User!
To modify your DAX calculations for the "This Year" and "This Month" columns to reflect the periods ending yesterday, you can adjust the variables for start and end dates accordingly. Below are the updated DAX formulas based on your requirements:
For "This Year"
This adjusted formula calculates the period from 27th April of the previous year to 26th April of the current year, as of yesterday (26th April 2024):
This Year =
VAR _EndDate = TODAY() - 1
VAR _StartDate = DATE(YEAR(_EndDate) - 1, MONTH(_EndDate) + 1, DAY(_EndDate))
RETURN
IF('CDCalendar'[CallDate] >= _StartDate && 'CDCalendar'[CallDate] <= _EndDate, 1, 0)Explanation:
- `_EndDate` is set to yesterday's date.
- `_StartDate` is set to the same day and month as `_EndDate` but from the previous year. This setup gives you the time period starting from 27th April of the last year to 26th April of the current year.
For "This Month"
This formula will calculate for the period from the 27th of the previous month to the 26th of the current month, as of yesterday (26th April 2024):
This Month =
VAR _EndDate = TODAY() - 1
VAR _StartDate = DATE(YEAR(_EndDate), MONTH(_EndDate), DAY(_EndDate) + 1) - 1
RETURN
IF('CDCalendar'[CallDate] >= _StartDate && 'CDCalendar'[CallDate] <= _EndDate, 1, 0)
If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍
@AnalyticsWizard Thanks for your reply, this worked with some minor tweaks only because I changed my mind on how many months I wanted to see, thanks for explaining it!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 56 | |
| 40 | |
| 35 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 38 | |
| 34 | |
| 23 |