Forum Discussion

ArchStanton's avatar
ArchStanton
Icon for Power Participant rankPower Participant
2 years ago

Remove future values but keep months on x axis

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,

11 Replies

  • 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())

    • ArchStanton's avatar
      ArchStanton
      Icon for Power Participant rankPower Participant

      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.

      • Anonymous's avatar
        Anonymous
        Not applicable

        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