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.
Hello, Thanks in advance for your assistance.
The following DAX lists the number of Active customers during a given month. My Years range over 2021, 2022 and will go into 2023. I don't want to show numbers for future dates. As we move into 2023, I don't want it to show monthly numbers for future Months. When I filter out the Month, it doesn't show any data for Dec of 2021.
How do I show the EndDatePerVisual to show MAX('Calendar'[Date]) as the last day of the month for all prior months but show Today() for the current Month & Year.
Number of Active Customers =
var EndDatePerVisual = MAX('Calendar'[Date])
var ActiveCustomers =
CALCULATE(
[Measure Count of New Customers],
REMOVEFILTERS('Calendar'),
'CustomerAccounts[Created Date] <=EndDatePerVisual,
'CustomerAccounts'[Account Closure Date] > EndDatePerVisual
|| ISBLANK('CustomerAccounts'[Account Closure Date])
)
VAR Result =
If(
Month(EndDatePerVisual) <= Month(TODAY()),
ActiveCustomers
)
Return
Result
Here is your problem:
If(
Month(EndDatePerVisual) <= Month(TODAY()),
ActiveCustomers
)
The comparison makes sure that year is not taken into account, only the month. You should check not only the month but the year as well. Even better, you should have a column in your date table that marks days as "past", "today", "future." Then it's easy to filter for past+today in any of your measures or via slicers.
Thanks for the response. I will look work on adding the recommended column to the date table.
How would I add the Year and Month to this section though?
If( Month(EndDatePerVisual) <= Month(TODAY()), ActiveCustomers )
@Mikebuci99 , refer this blog and file dealing with two dates to find active
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
53 | |
27 | |
24 | |
14 | |
9 |
User | Count |
---|---|
76 | |
58 | |
47 | |
17 | |
12 |