Forum Discussion

Harish85's avatar
Harish85
Icon for Helper III rankHelper III
1 year ago
Solved

Created Fiscal_period using below sap formula

Below is the formula written in webi Report sap ,same variable should be created in powerbi

v_fiscal_period =If([v_Fiscal_Month]="07";"4";
If([v_Fiscal_Month]="06";"3";
If([v_Fiscal_Month]="05";"2";
If([v_Fiscal_Month]="04";"1";
If([v_Fiscal_Month]="03";"12";
If([v_Fiscal_Month]="02";"11";
If([v_Fiscal_Month]="01";"10";
If([v_Fiscal_Month]="12";"9";
If([v_Fiscal_Month]="11";"8";
If([v_Fiscal_Month]="10";"7";
If([v_Fiscal_Month]="09";"6";
If([v_Fiscal_Month]="08";"5";[v_Fiscal_Month]))))))))))))

  • Harish85 , Try using switch DAX

    v_fiscal_period =
    SWITCH(
    TRUE(),
    [v_Fiscal_Month] = "07", "4",
    [v_Fiscal_Month] = "06", "3",
    [v_Fiscal_Month] = "05", "2",
    [v_Fiscal_Month] = "04", "1",
    [v_Fiscal_Month] = "03", "12",
    [v_Fiscal_Month] = "02", "11",
    [v_Fiscal_Month] = "01", "10",
    [v_Fiscal_Month] = "12", "9",
    [v_Fiscal_Month] = "11", "8",
    [v_Fiscal_Month] = "10", "7",
    [v_Fiscal_Month] = "09", "6",
    [v_Fiscal_Month] = "08", "5",
    [v_Fiscal_Month]
    )

  • Harish85 

    New Column DAX

    v_fiscal_period = 
    SWITCH(
    TRUE(),
    [v_Fiscal_Month] = "07", "4",
    [v_Fiscal_Month] = "06", "3",
    [v_Fiscal_Month] = "05", "2",
    [v_Fiscal_Month] = "04", "1",
    [v_Fiscal_Month] = "03", "12",
    [v_Fiscal_Month] = "02", "11",
    [v_Fiscal_Month] = "01", "10",
    [v_Fiscal_Month] = "12", "9",
    [v_Fiscal_Month] = "11", "8",
    [v_Fiscal_Month] = "10", "7",
    [v_Fiscal_Month] = "09", "6",
    [v_Fiscal_Month] = "08", "5",
    [v_Fiscal_Month]
    )

    πŸ’Œ If this helped, a Kudos πŸ‘ or Solution mark would be great! πŸŽ‰
    Cheers,
    Kedar
    Connect on LinkedIn

3 Replies

  • Harish85 

    New Column DAX

    v_fiscal_period = 
    SWITCH(
    TRUE(),
    [v_Fiscal_Month] = "07", "4",
    [v_Fiscal_Month] = "06", "3",
    [v_Fiscal_Month] = "05", "2",
    [v_Fiscal_Month] = "04", "1",
    [v_Fiscal_Month] = "03", "12",
    [v_Fiscal_Month] = "02", "11",
    [v_Fiscal_Month] = "01", "10",
    [v_Fiscal_Month] = "12", "9",
    [v_Fiscal_Month] = "11", "8",
    [v_Fiscal_Month] = "10", "7",
    [v_Fiscal_Month] = "09", "6",
    [v_Fiscal_Month] = "08", "5",
    [v_Fiscal_Month]
    )

    πŸ’Œ If this helped, a Kudos πŸ‘ or Solution mark would be great! πŸŽ‰
    Cheers,
    Kedar
    Connect on LinkedIn

    • Harish85's avatar
      Harish85
      Icon for Helper III rankHelper III

      Thank you very much this helped a lot for me.

  • Harish85 , Try using switch DAX

    v_fiscal_period =
    SWITCH(
    TRUE(),
    [v_Fiscal_Month] = "07", "4",
    [v_Fiscal_Month] = "06", "3",
    [v_Fiscal_Month] = "05", "2",
    [v_Fiscal_Month] = "04", "1",
    [v_Fiscal_Month] = "03", "12",
    [v_Fiscal_Month] = "02", "11",
    [v_Fiscal_Month] = "01", "10",
    [v_Fiscal_Month] = "12", "9",
    [v_Fiscal_Month] = "11", "8",
    [v_Fiscal_Month] = "10", "7",
    [v_Fiscal_Month] = "09", "6",
    [v_Fiscal_Month] = "08", "5",
    [v_Fiscal_Month]
    )