Calculation depending on current month

I have an app which shows a Progress Bar that calculates % of Revenue divided by Budget. As of now the only way this works is if a selects a month or quarter from filters on the dashboard (year is defaulted for them via a page filter). I would like to update this so that the dashboard defaults to the current month, so the user does not have to manually filter on the month ever time. But, if the user selects a month or quarter via one of the filters on the dashboard, the progress bar updates to calculate % based the parameters they've chosen.

I don't want to achieve this through a page filter as there are many other cards on the page that I do not want to default to a specific month.

Any help is greatly appreciated!

Best Answer

  • Manasi_Panov
    Manasi_Panov Contributor
    Answer ✓

    Hi @mcasey02,

    If I understand correctly, you require a variable filter for the progress bar. Here's an example applied to a bar chart.

    Here is in more details to visualize the implementation of the variables:

    Here is the variable:

    For the x-axis, I have the variable timeframe. In the case of a Progress Bar, I don't think this is needed:

    Then the same variable controls the calculations that are different by Month, by Quarter, or by Year. Here you can implement your logic/calculation:

    If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.

Answers

  • You can set the date range on the card to be "this month" or "previous month"

    If I solved your problem, please select "yes" above

  • mcasey02
    mcasey02 Member
    edited December 12

    Maybe I'm doing something wrong, but once I've filtered the Progress Bar card to "This Month," I don't think there's a way I can allow users to modify the date range unless they go into the card and do it themselves. For a variety of reasons I want them to use existing filter cards on the dashboard for month, quarter and year to switch from a default value to a user-selected value. Letting them go into the cards and change the range themselves is not an option in this case. Maybe this can be achieved through variables?

  • Manasi_Panov
    Manasi_Panov Contributor
    Answer ✓

    Hi @mcasey02,

    If I understand correctly, you require a variable filter for the progress bar. Here's an example applied to a bar chart.

    Here is in more details to visualize the implementation of the variables:

    Here is the variable:

    For the x-axis, I have the variable timeframe. In the case of a Progress Bar, I don't think this is needed:

    Then the same variable controls the calculations that are different by Month, by Quarter, or by Year. Here you can implement your logic/calculation:

    If you found this post helpful, please use 💡/💖/👍/😊 below! If it solved your problem, don't forget to accept the answer.