Forum Discussion
powerbiexpert22
2 years agoImpactful Individual
sort year month
how to sort year month column in line chart, i have yearmonth column in "YYYY-MMM" format example 2023-Jun if i try to sort YearMonth calculated column by Month( numeric column) then it only sort Ye...
- 2 years ago
Hi powerbiexpert22
Try to create a column using below code:Step 1:===========YearMonth_NEW =VAR _MONTH = MONTH('Date'[Date])VAR _YEAR = YEAR('Date'[Date])VAR _Result = DATE(_YEAR,_MONTH,1)RETURN _ResultStep 2:=======Change the Datatype as "Date"Change the Format as "mmmm,yyyy"From the top pane in Table ViewStep 3:=========Pull the above YearMonth_NEW column into line chart. - 2 years ago
Hi powerbiexpert22 - Please check the image provided above, it is coming as per year and month sorting only.
Year-Month-Sort = YEAR('Date'[Date])*12+MONTH('Date'[Date])-1Hope it worksstill any discrepency, please share the expected output.
Chakravarthy
2 years agoResolver II
Hi powerbiexpert22
Try to create a column using below code:
Step 1:
===========
YearMonth_NEW =
VAR _MONTH = MONTH('Date'[Date])
VAR _YEAR = YEAR('Date'[Date])
VAR _Result = DATE(_YEAR,_MONTH,1)
RETURN _Result
Step 2:
=======
Change the Datatype as "Date"
Change the Format as "mmmm,yyyy"
From the top pane in Table View
Step 3:
=========
Pull the above YearMonth_NEW column into line chart.