Forum Discussion

Dimitris_Kats's avatar
4 years ago
Solved

Calculations based on month

Hello dear members,

 

In my model I have created an independed table with percentages from 1%-100% and I have  this formula :

IF(DISTINCTCOUNT(Percentage[Value])>1, CALCULATE(SUM(Table1[Salary]) ), IFERROR( CALCULATE(SUM(Table1[Salary])*(1+MAX(Percentage[Value])),BLANK()))

 

I calculate the salary based on the percentage selection from the slicer.

 

So I have a report like this:

 

                        January     February       March      April     May    June   July     August   September   October   November   December

IT DIVISION      10000         10000         10000     10000  10000  10000 10000   10000    10000           10000       10000         10000  

 

If the user chooses, for example 5% all these amounts will be increase by 5%
I want this calculationto be applied only to specific months ( April - December) . January to March i want to show only this SUM(Table1[Salary])

 

How can i do this?

Thank you in advance

  • Hi Dimitris_Kats 

     

    You can create a measure with Switch statement:

    SWITCH(
    TRUE(),
    MAX('Table'[Month]) IN {"Jan", "Feb", "Mar"}, SUM(SALARY),
    MAX('Table'[Month]) IN {"Apr", ----- , "Dec"}, SUM(SALARY) + ([Selected Percentage] * SUM(Salary))
    )
    Hope this helps.
    Regards,
    Kishore

2 Replies

  • Hi Dimitris_Kats 

     

    You can create a measure with Switch statement:

    SWITCH(
    TRUE(),
    MAX('Table'[Month]) IN {"Jan", "Feb", "Mar"}, SUM(SALARY),
    MAX('Table'[Month]) IN {"Apr", ----- , "Dec"}, SUM(SALARY) + ([Selected Percentage] * SUM(Salary))
    )
    Hope this helps.
    Regards,
    Kishore