Forum Discussion
How to Assign Month Number Dynamically
- 8 years ago
veer,
Please create calculated column in your table with formula below:
DynamicMonth = IF(MOD(MONTH(Table1[CreatedDate]) - MONTH(TODAY())+12,12)=0,12,MOD(MONTH(Table1[CreatedDate]) - MONTH(TODAY())+12,12))
Dynamic month in DAX
Where Table1 = your table name,
[CreatedDate] = your date field name.
Let me know if I understood you correct.
veer,
What do you mean under dynamically here?
I see that you just made offset. Do you mean each time Feb = 1, .., Apr = 3 etc.? And it would be for now, January and the same would be for next months like every time Feb = 1, .., Apr = 3 etc?
Or in February you should have Mar = 1,..,May=3, etc?
Where do you plant to user this month number? Or just to sort chart you've shown?
- veer8 years agoFrequent Visitor
zoloturucurrent month is -Jan ..so i want current month number is 12
current, jan 12, _current - 1, 11, _current - 2, 10, _current - 3, 9, _current - 4, 8, _current - 5, 7, _current - 6, 6, _current - 7, 5, _current - 8, 4, _current - 9, 3, _current - 10, 2, _current - 11, 1,this type logic i want ..in dax
- zoloturu8 years agoMemorable Member
veer,
Please create calculated column in your table with formula below:
DynamicMonth = IF(MOD(MONTH(Table1[CreatedDate]) - MONTH(TODAY())+12,12)=0,12,MOD(MONTH(Table1[CreatedDate]) - MONTH(TODAY())+12,12))
Dynamic month in DAX
Where Table1 = your table name,
[CreatedDate] = your date field name.
Let me know if I understood you correct.