Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Create a column in my dimension table which says my Month minus 1, current Month so on

Hi friends,

I made two dimension CYCLE and Period and a fact with the values below. 

S&OE Cycle (Month)01/09/201801/10/201801/11/201801/12/201801/01/201901/02/2019 
01/10/20182212210001950185015001950 
01/11/2018205420542054205420502054 



I need a column that says to me when a cycle is selected get the month of the cycle and includ M for the Period which has the same month of the cycle selected, 

I made it work looking at the month of the current date instead of looking at the month of the selected cycle: 

VAR Current_Month_Year = DATE(YEAR(TODAY());MONTH(TODAY());01)
VAR M_MINUS_1        = MONTH(EOMONTH(Current_Month_Year;-1)) & YEAR(EOMONTH(Current_Month_Year;-1))
VAR M        = MONTH(EOMONTH(Current_Month_Year;0)) & YEAR(EOMONTH(Current_Month_Year;0))
VAR M_PLUS_1        = MONTH(EOMONTH(Current_Month_Year;1)) & YEAR(EOMONTH(Current_Month_Year;1))
VAR M_PLUS_2        = MONTH(EOMONTH(Current_Month_Year;2)) & YEAR(EOMONTH(Current_Month_Year;2))
VAR M_PLUS_3        = MONTH(EOMONTH(Current_Month_Year;3)) & YEAR(EOMONTH(Current_Month_Year;3))

RETURN

SWITCH(
MONTH(D_Period[Period]) & YEAR(D_Period[Period]);
M_MINUS_1;0;
M;1;
M_PLUS_1;2;
M_PLUS_2;3;
M_PLUS_3;4;
BLANK()
)

Could anyone help me please?

Regards,
Luiz Gustavo
1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi Luiz,

 

Could you make it more clear, please?

1. Is the data here in a visualization or in a source table?

2. Is the "a cycle is selected" a slicer visual?

3. Is the desired column in the source table?

Can you share a sample of the original data?

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.