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 need to display last 6 months from the fiscal month column ignoring the current month (data type is text-FY22JAN) .The fiscal month totally containing 18 months and i need to display only last six months. and also the date table is not the hirarchey one. how i need to write DAX expression for this. Please help me out anyone immediately.
Solved! Go to Solution.
Hi, actually i have calendar date column . so i have solved this without writing any measure using PBI only.
i have dragged calendar date column in filters on page then , in last 6 month i have selected and then i selected calendar months means only completed months. so it will give only last six months of of fiscal month column even if the year changes later.
Hi @Anonymous,
That’s great! Thanks for your reply!
Could you please mark the solution by Accept it as the solution to help other members find it more quickly. Thanks in advance!
Best Regards,
Community Support Team _ Caiyun
Hi @Anonymous,
Not sure how your model looks like. If you don’t have a calendar table, you may try this solution.
Create a Measure as follows. It will help you filter out the last six months.
LastSixMonths =
VAR year_ =
2000 + LEFT ( RIGHT ( MAX ( 'Fiscal Month'[fiscal month] ), 5 ), 2 )
VAR month_ =
RIGHT ( MAX ( 'Fiscal Month'[fiscal month] ), 3 )
VAR month_no =
SWITCH (
month_,
"Jan", 1,
"Feb", 2,
"Mar", 3,
"Apr", 4,
"May", 5,
"Jun", 6,
"Jul", 7,
"Aug", 8,
"Sep", 9,
"Oct", 10,
"Nov", 11,
"Dec", 12
)
VAR fiscalDate =
DATE ( year_, month_no, 1 )
VAR firstDay =
DATE ( year_, month_no, 1 )
VAR currentTime =
TODAY ()
VAR currentYear =
YEAR ( currentTime )
VAR currentMonth =
MONTH ( currentTime )
VAR lastSixMonOfCur = 12 - ( 6 - currentMonth )
VAR MinDate =
IF (
lastSixMonOfCur >= 6,
DATE ( currentYear - 1, lastSixMonOfCur, 1 ),
DATE ( currentYear, lastSixMonOfCur, 1 )
)
RETURN
IF (
fiscalDate >= MinDate
&& fiscalDate < DATE ( currentYear, currentMonth, 1 ),
1,
0
)
After that, you could calculated based on it or just filter visual data by dragging it to Filters pane.
Also, attached the pbix file as reference.
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi, actually i have calendar date column . so i have solved this without writing any measure using PBI only.
i have dragged calendar date column in filters on page then , in last 6 month i have selected and then i selected calendar months means only completed months. so it will give only last six months of of fiscal month column even if the year changes later.
Hi @Anonymous,
That’s great! Thanks for your reply!
Could you please mark the solution by Accept it as the solution to help other members find it more quickly. Thanks in advance!
Best Regards,
Community Support Team _ Caiyun
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 |
---|---|
46 | |
25 | |
19 | |
16 | |
8 |
User | Count |
---|---|
61 | |
50 | |
45 | |
20 | |
17 |