Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am implementing functionality where when i select multiple options from filter pane, I have bar chart where I am showing yearly data so I want to only show the maximum month-year data from the selection per year,
Right now it should only show Apr-2021 data, i select option from 2021 and 2022 then it should show the 2 bar with maximum month from selection.
Thanks, let me know it is possible or not.
You don't need the Only():
SUM(
{<[CREATED_DATE-Year-Month]={$(=Concat(Aggr(Chr(39) & Max([CREATED_DATE-Year-Month]) & Chr(39), Year([CREATED_DATE-Year-Month])), ','))}>}
[FA_QTY_FUNC] * [AVERAGE_PRICE]
)
This expression always returns the sum for the latest possible [CREATED_DATE-Year-Month]. No set analysis or complex Aggrs needed:
FirstSortedValue(Aggr(Sum([FA_QTY_FUNC] * [AVERAGE_PRICE]), [CREATED_DATE-Year-Month]), -[CREATED_DATE-Year-Month])
It also works with the "year" as the dimension:
Aggr(Year([CREATED_DATE-Year-Month]), [CREATED_DATE-Year-Month])
Please clarify:
@LRuCelver Thanks for replying,
By default if no selection made right now I am showing the data of latest month for specific year, year is dimension
for example:- for 2021 i am showing data of 2021 dec,
for 2022 I am showing data of 2022 dec.
for 2024 I am showing data for 2022 Feb ( which is latest month data in 2024) so this is working perfectly right now,
Now I need to handle the scenario when selection made if there is one selection made let's say 2021-jun then bar should only show data for 2021-jun,
But multiple selection made then let's say 2021-jun, 2021-july then it should show the data of 2021-july
another scenario is if 2021-jun, 2021-july, 2022-jan, 2022-feb then it should show 2 bars, 1st for 2021 where data should be 2021-july and 2nd for 2022 where data should be 2022-feb.
I know this is complex but let me know if you get it or not.
Thanks
This shows the only remaining Year-Month for every Year after applying the set analysis:
{<[Month-Year]={$(=Concat(Aggr(Chr(39) & Max([Month-Year]) & Chr(39), Year), ','))}>}
Only([Month-Year])
Replace the Only() expression with whatever you need it to be.
Here are the results for multiple selections over different years:
@LRuCelver this is what I want, i tried above expression but when I selecte more than one selection chart is not showing up, this is my expression
SUM({<[CREATED_DATE-Year-Month]={$(=Concat(Aggr(Chr(39) & Max([CREATED_DATE-Year-Month]) & Chr(39), Year([CREATED_DATE-Year-Month])), ','))}>} Only([FA_QTY_FUNC] * [AVERAGE_PRICE]))
Let me know what changes I should make it to work
Thanks
You don't need the Only():
SUM(
{<[CREATED_DATE-Year-Month]={$(=Concat(Aggr(Chr(39) & Max([CREATED_DATE-Year-Month]) & Chr(39), Year([CREATED_DATE-Year-Month])), ','))}>}
[FA_QTY_FUNC] * [AVERAGE_PRICE]
)
Still not working with bar chart, maybe because of year dimension?
This is the expression im using for dimension year Year([CREATED_DATE-Year-Month])
You are correct.
You need to add a new field [CREATED_DATE-Year] using Year([CREATED_DATE-Year-Month]) as the calculation expression in the script to the data model.
Ok but right now I don't have option of script, I have only one option with chart expression, is there anything we can do about it?
This expression always returns the sum for the latest possible [CREATED_DATE-Year-Month]. No set analysis or complex Aggrs needed:
FirstSortedValue(Aggr(Sum([FA_QTY_FUNC] * [AVERAGE_PRICE]), [CREATED_DATE-Year-Month]), -[CREATED_DATE-Year-Month])
It also works with the "year" as the dimension:
Aggr(Year([CREATED_DATE-Year-Month]), [CREATED_DATE-Year-Month])