Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a data with Year month name and month number and the information. we are using financial year format ( April - March).
My requirement is when I select in slicer month data need to get along with from April for ex: If i select August 2021 i should get the data from April till August. If I select December I should get from April till December. Please suggest.
Solved! Go to Solution.
Hi, @Anonymous ;
If your format is "October 2020" , you could use follows dax to change it as date format.
date = DATE(RIGHT([year-month],4),MONTH( LEFT([year-month], SEARCH(" ",[year-month]))&" 1"),1)
then you could create a table as a slicer .
slicer = VALUES('Table'[year-month])
then create a measure to calculate a sum .
sum =
VAR _select =MAX ( 'slicer'[year-month] )
VAR _sdate =
DATE ( RIGHT ( _select, 4 ), MONTH ( LEFT ( _select, SEARCH ( " ", _select ) ) & " 1" ), 1)
RETURN
IF (
MONTH ( _sdate ) >= 4,
CALCULATE (
SUM ( [value] ),
FILTER ( 'Table', [date] >= DATE ( YEAR ( _sdate ), 4, 1 ) && [date] <= _sdate )),
CALCULATE (
SUM ( [value] ),
FILTER (
ALL ( 'Table' ),
[date]
>= DATE ( YEAR ( _select ) - 1, 4, 1 )
&& [date] <= _sdate)))
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous ;
If your format is "October 2020" , you could use follows dax to change it as date format.
date = DATE(RIGHT([year-month],4),MONTH( LEFT([year-month], SEARCH(" ",[year-month]))&" 1"),1)
then you could create a table as a slicer .
slicer = VALUES('Table'[year-month])
then create a measure to calculate a sum .
sum =
VAR _select =MAX ( 'slicer'[year-month] )
VAR _sdate =
DATE ( RIGHT ( _select, 4 ), MONTH ( LEFT ( _select, SEARCH ( " ", _select ) ) & " 1" ), 1)
RETURN
IF (
MONTH ( _sdate ) >= 4,
CALCULATE (
SUM ( [value] ),
FILTER ( 'Table', [date] >= DATE ( YEAR ( _sdate ), 4, 1 ) && [date] <= _sdate )),
CALCULATE (
SUM ( [value] ),
FILTER (
ALL ( 'Table' ),
[date]
>= DATE ( YEAR ( _select ) - 1, 4, 1 )
&& [date] <= _sdate)))
The final output is shown below:
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous YTD should help
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"03/31"))
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
But I dont have a date format so could not able to do YTD
I have Only Year Month name and month number in seperated columns and I couldn't able to build a date format with this information since I dont have a date
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |