Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi Community
I am asking for your help with a DAX measure i cant seem to figure out how to put together. Here is what i require.
I want to create a bar chart that could look similar to the snippet i provided. (it shows year to date values from current fiscal year 2024-25) and four years back.
However, i want to create a DAX measure that shows year to date, for my current fiscal year, i have a measure for that, where it takes into consideration my month selected in a slicer. Anything that is not current fiscal year should return the full year and disregard the month.
I hope someone can help me provide what the code would look like to achieve this.
Solved! Go to Solution.
Hi @Nicpet0 ,
I create a table as you mentioned.
Then I create a measure and here is the DAX code.
Measure =
VAR _CurrentFY_YTD =
CALCULATE ( SUM ( 'Table'[Amount] ), DATESYTD ( 'Table'[Date], "6/30" ) )
VAR _FullYear_PreviousYears =
CALCULATE (
SUM ( 'Table'[Amount] ),
ALLEXCEPT ( 'Table', 'Table'[FiscalYear] )
)
RETURN
IF (
MAX ( 'Table'[FiscalYear] ) = "2024-25",
_CurrentFY_YTD,
_FullYear_PreviousYears
)
So when I select the slicer, it will get what you want in the bar chart.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Nicpet0 ,
I create a table as you mentioned.
Then I create a measure and here is the DAX code.
Measure =
VAR _CurrentFY_YTD =
CALCULATE ( SUM ( 'Table'[Amount] ), DATESYTD ( 'Table'[Date], "6/30" ) )
VAR _FullYear_PreviousYears =
CALCULATE (
SUM ( 'Table'[Amount] ),
ALLEXCEPT ( 'Table', 'Table'[FiscalYear] )
)
RETURN
IF (
MAX ( 'Table'[FiscalYear] ) = "2024-25",
_CurrentFY_YTD,
_FullYear_PreviousYears
)
So when I select the slicer, it will get what you want in the bar chart.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Nicpet0
you can write a measure as follows:
measure YTD := var this_year = max( dimdate[year]) -- or you also can write year(today()), depend to your data
return
calculate(sum(quantity) , filter (all(your_table) , your_table[year] = this_year))
If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.
User | Count |
---|---|
13 | |
10 | |
8 | |
7 | |
5 |
User | Count |
---|---|
24 | |
16 | |
15 | |
10 | |
7 |