Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi everyone,
I’m encountering an issue with my KPI card visual where the target value (calculated by my MaxMonthlyExports measure) doesn’t show the correct maximum monthly exports for the selected year in slicer.
How can I modify my MaxMonthlyExports measure so that it correctly returns the maximum monthly exports for 2024?
Please refer to the below image, where I have hilighted the issue which is the Goal in yellow for the KPI card visual with title LatestMonthExports and MaxMonthlyExports by Year Month Number.
I have a Power BI report that uses a slicer based on a date hierarchy (specifically, tDate[Year][Month]). When I apply the slicer for the year 2024, my KPI card visual is supposed to display the following:
Value: The latest monthly exports using my LatestMonthExports measure.
Trend Axis: The month ordering provided by tDate[Year Month Number].
Target: The maximum monthly exports for the selected year (calculated by MaxMonthlyExports).
For example, under the 2024 slicer:
Expected LatestMonthExports: 2599
Expected Target (MaxMonthlyExports): 3074 (from October 2024)
Instead, both the value and the target show 2599 (with the target label showing 2024-12), meaning the KPI card target is returning the same value as the latest month’s exports, rather than the maximum across all months.
tExports and tDate(calculated table)
Here are the DAX measures I’m using:
LatestMonthExports =
VAR LatestDate = LASTDATE(tExports[weekEndingDate])
VAR LatestEOM = EOMONTH(LatestDate, 0)
VAR Result =
CALCULATE(
SUM(tExports[weeklyExports]),
EOMONTH(tExports[weekEndingDate], 0) = LatestEOM
)
RETURN
Result
MonthlyExports =
VAR Result =
CALCULATE(
SUM(tExports[weeklyExports])
)
RETURN
Result
MaxMonthlyExports =
VAR Result =
MAXX(
VALUES(tDate[Month Year]),
[MonthlyExports]
)
RETURN
Result
MaxMonthToolTip =
VAR MaxMonth =
SELECTCOLUMNS(
TOPN(1, VALUES(tDate[Month Year]), [MaxMonthlyExports], DESC),
"MaxMonth", tDate[Month Year]
)
RETURN
MaxMonth
Apply the Year slicer for 2024.
Use the KPI card visual with:
Value field: LatestMonthExports
Trend Axis: tDate[Year Month Number]
Target field: MaxMonthlyExports
Observe that the KPI card shows 2599 for both the value and the target, with the target’s label showing 2024-12, even though the correct maximum should be 3074 (occurring in October 2024).
I have attached the sample Excel data source and the Power BI (.pbix) file for reference. [Link](USDA FAS ESR)
Any help or suggestions would be greatly appreciated!
Thanks in advance for your assistance.
Solved! Go to Solution.
Hi @Anonymous,
Thank you for your time.
I have fixed the issue where the KPI cad does not respect the Year slicer passed on.
I fixed it by changing the logic for .MaxMonthlyExports measure, I used ALLSELECTED(tDate) which will respect the filters coming from outside while ignoring the filters appled inside query ( Source: ALLSELECTED – DAX Guide )
MaxMonthlyExports =
VAR MaxExportValue =
IF(
NOT ISBLANK([MonthlyExports]),
CALCULATE(
MAXX(
VALUES(tDate[Month Year]),
[MonthlyExports]
),
ALLSELECTED(tDate)
),
BLANK()
)
RETURN
MaxExportValue
The latest Month Exports are 674 for March 2025 at Value field. ✅
The Max Exports Month are 4350 for February 2025 at Goal field aka Taget field. ✅
2. When slicer year 2024 applied:
The latest Month Exports are 2599 for December 2024 at Value field. ✅
The Max Exports Month are 3074 for October 2024 at Goal field aka Taget field. ✅
As I found the issues resolved, I am myself marking this reply as the solution.
Please let me know if there are questions or any issues.
Thank you.
Hi @Anonymous,
Thank you for your time.
I have fixed the issue where the KPI cad does not respect the Year slicer passed on.
I fixed it by changing the logic for .MaxMonthlyExports measure, I used ALLSELECTED(tDate) which will respect the filters coming from outside while ignoring the filters appled inside query ( Source: ALLSELECTED – DAX Guide )
MaxMonthlyExports =
VAR MaxExportValue =
IF(
NOT ISBLANK([MonthlyExports]),
CALCULATE(
MAXX(
VALUES(tDate[Month Year]),
[MonthlyExports]
),
ALLSELECTED(tDate)
),
BLANK()
)
RETURN
MaxExportValue
The latest Month Exports are 674 for March 2025 at Value field. ✅
The Max Exports Month are 4350 for February 2025 at Goal field aka Taget field. ✅
2. When slicer year 2024 applied:
The latest Month Exports are 2599 for December 2024 at Value field. ✅
The Max Exports Month are 3074 for October 2024 at Goal field aka Taget field. ✅
As I found the issues resolved, I am myself marking this reply as the solution.
Please let me know if there are questions or any issues.
Thank you.
Hi @dheerajyss,
We suggest you change the Trend axis ato Date_Year, as shown below:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Thank you for responding.
My observations from your suggested solution:
What I am expecting:
If there is no alternative way to achieve this, I might have to let go of this requirement for now.
My Questions:
Thank you again for your time and help!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 38 | |
| 38 | |
| 28 | |
| 27 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 73 | |
| 66 | |
| 65 |