Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi
I would like to remove the future line values from this chart but keep the Apr - Mar x axis visible.
The line axis is based on this DAX code:
DD YTD Cases = CALCULATE(
TOTALYTD(COUNT('Cases'[Case Number]),'Date2'[Date],"31/3"))
I've seen various recommendations here but none that keep the Apr - Mar months visible
Can anybody help?
Thanks,
@ArchStanton , Try like
DD YTD Cases =
var _max = maxx(allselected('Case'), 'Case'[Case Date])
return
return if(Max(Date[Date]) <=_max ,
CALCULATE( TOTALYTD(COUNT('Cases'[Case Number]),'Date2'[Date],"31/3")), blank())
I don't have a column called 'Case Date' so i'm not sure how to implement this?
I do have a 'Created on' date in the Cases table which I've tried using but I get this error:
DD YTD Cases2 =
VAR _Max = MAXX(ALLSELECTED('Cases'),'Cases'[Created On])
RETURN
IF(MAX(Date2[MonthName] <= _Max,
CALCULATE(
TOTALYTD(COUNT('Cases'[Case Number]),'Date2'[Date],"31/3"),BLANK())))
The Month in my x-axis comes from the Date2 calendar table and it is sorted by FYMonthNo where APR = 1st month. Created On and Date2[Date] has an active relationship in my model.
Hi @ArchStanton ,
Please update the formula of measure as below and check if it can return the expected result...
DD YTD Cases2 =
VAR _Max =
MAXX ( ALLSELECTED ( 'Cases' ), 'Cases'[Created On] )
RETURN
IF (
MAX ( Date2[MonthName] ) <= _Max,
CALCULATE (
TOTALYTD ( COUNT ( 'Cases'[Case Number] ), 'Date2'[Date], "31/3" ),
BLANK ()
)
)
If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi _Rena
I got this error message after using your suggestion:
Hi @ArchStanton ,
Thanks for your feedback. Please update the formula of measure [DD YTD Cases2] as below:
DD YTD Cases2 =
VAR _Max =
MAXX ( ALLSELECTED ( 'Cases' ), 'Cases'[Created On] )
RETURN
IF (
MAX ( Date2[MonthName] ) <= _Max,
TOTALYTD ( COUNT ( 'Cases'[Case Number] ), 'Date2'[Date], "31/3" ),
BLANK ()
)
Best Regards
The formula doesn't produce any error messages anymore but when I add it to the chart I get this:
Hi @ArchStanton ,
According to the screenshot, it seems that the condition "MAX ( Date2[MonthName] ) <= _Max" cause the error. Is the data type of field Date2[MonthName] Text? And the data type of field 'Cases'[Created On] is Date type. Please update the formula of measure as below:
DD YTD Cases2 =
VAR _Max =
MAXX ( ALLSELECTED ( 'Cases' ), 'Cases'[Created On] )
RETURN
IF (
MAX ( Date2[Date] ) <= _Max,
TOTALYTD ( COUNT ( 'Cases'[Case Number] ), 'Date2'[Date], "31/3" ),
BLANK ()
)
If the above one can't help you get the expected result, please provide some raw data in your tables (exclude sensitive data) with Text format, the visual Fields settings and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Same 'Couldn't load data for this visual' merror message when I tried it.
Hi @ArchStanton ,
Could you please provide a simplified sample pbix file(remove the sensitive info)? Thank you.
How to upload PBI in Community
Best Regards
HI, Can you share your pbix file please? If this is working for you then it may help me to spot any differences?
Just to reiterate, in my Date2 Calendar I have a MonthName column sorted on FYMthNumber with Apr = 1.
Hope that helps?
Unfortunately I can't, this is part of a very large data model that is connected to a live Case Management System.
In the original Line & Bar Chart I posted, the black line is based on =
DD YTD Cases = CALCULATE(
TOTALYTD(COUNT('Cases'[Case Number]),'Date2'[Date],"31/3"))
The green bars however are not a measure, they are just a count of Ids, they are in effect showing the same thing, except the black line which is Cumulative. The Green bars stop in Sep but the Black line continues all the way to Apr. Why is it so difficult to halt the Black line on the same month when they are based on the same data?
I find DAX incredibly frustrating as the requirement here, on paper at least, sounds straightforward.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
102 | |
75 | |
44 | |
39 | |
32 |
User | Count |
---|---|
161 | |
87 | |
64 | |
46 | |
42 |