Forum Discussion

ConnorCrawford's avatar
ConnorCrawford
Regular Visitor
1 year ago
Solved

Bar chart bringing back too many columns

Hi,

 

I'm trying to create a Revenue by Month bar chart against a budget:

 

 

I'm happy for the budget to be across the whole financial year; however, I have the slicer on my page set to Feb-25, so the measure below set to less than or equal to Feb-25:

 

Revenue by Month = CALCULATE([Margin], REMOVEFILTERS('Date'), FILTER('Date', 'Date'[Period] <= SELECTEDVALUE('Date'[Period])), Actuals[PL Type] = "Revenue")
 
How do I get the visual to only show columns up to February?
  • Hi,

     

    I ended up creating a second date table with no relationships between the data tables - this solved the problem as I could use keep the interaction between the slicer and graph, use SELECTEDVALUE and it not filter to one month only.

7 Replies

  • ConnorCrawford , Try using

     

    DAX
    Revenue by Month =
    CALCULATE(
    [Margin],
    REMOVEFILTERS('Date'),
    FILTER(
    ALL('Date'),
    'Date'[Period] <= SELECTEDVALUE('Date'[Period])
    ),
    Actuals[PL Type] = "Revenue"
    )

    • ConnorCrawford's avatar
      ConnorCrawford
      Regular Visitor

      Thanks for the reply,

       

      However, this has created cumulative months rather than removing the column on March:

       

       

  • For more info:

     

    - I have turned off interactions with the slicer as it affects the axis (not sure if this means I then can't use selectedvalue?

    - When I manually type in the period in this measure - 

    Revenue by Month = CALCULATE([Margin], 'Date'[Period] <= 202502, Actuals[PL Type] = "Revenue") - it works
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello ConnorCrawford ,

     

    Thank you for reaching out to Microsoft Fabric Community Forum.

    bhanu_gautam Thank you for your quick response.

     

    Please try the below measure:


    Revenue by Month =
    VAR SelectedPeriod = MAX('Date'[Period]) // This reads from the slicer context
    RETURN
    CALCULATE(
    [Margin],
    FILTER(
    ALLSELECTED('Date'),
    'Date'[Period] <= SelectedPeriod
    ),
    Actuals[PL Type] = "Revenue"
    )

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!

    Regards,

    B Manikanteswara Reddy

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ConnorCrawford ,

     

    We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?

     

    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,

    B Manikanteswara Reddy

  • Hi,

     

    I ended up creating a second date table with no relationships between the data tables - this solved the problem as I could use keep the interaction between the slicer and graph, use SELECTEDVALUE and it not filter to one month only.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi ConnorCrawford ,

       

      It looks like your problem has been solved, please mark the helpful reply and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster .

      Thank you very much for your kind cooperation!

       

      Regards,

      B Manikanteswara Reddy