Forum Discussion

MiraAnniina's avatar
MiraAnniina
New Member
5 years ago
Solved

Calculated measures

Do you know if it's possible to make such function, that shows calculated measures on rows based on months on columns? I have calculated measures on rows and calendar-hierarchy from tabular model.

 

I would like to have a function like:

 

JanuaryMeasure =  if ( month="Jan" , xxx )

FebruaryMeasure =  if ( month="Feb" , xxx )

 

I can't seem to figure this out 😕 I studied the internet and it seems that function IF works with measures, but what kind of function would work with months? 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi MiraAnniina 

    In addition to  

    Measure = 
    SWITCH(MAX('Table'[Month]),"January","xxx","February","yyy","zzz")

    Calculated column:

    Calculated column = 
    SWITCH('Table'[Month],"January","xxx","February","yyy","zzz")

    Result is as below.

    Build a matrix visual and don't forget set show values in row in Format.

    If you want to show result as you show above, you may need to build measures for each month.

     

    Best Regards,

    Rico Zhou

     

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

     

5 Replies

  • Hi MiraAnniina 

    I'm not very clear about what you want to do.  Can you please provide some examples of the data and the results you want.

    regards

    Phil

  • Hi, sorry for my poor question. I will try to be more clear. Does this example help:

     

     JanuaryFebruary
    Measure 1 (on Jan)xxx 
    Measure 2 (on Feb) yyy

     

    Now I'm looking for a function, that would show these "xxx" and "yyy" on the report based on the month column. So I would have a measure on rows and depending on the month, it will or will not show the amount. What would my functions look like on rows Measure 1 and Measure 2?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi MiraAnniina 

      In addition to  

      Measure = 
      SWITCH(MAX('Table'[Month]),"January","xxx","February","yyy","zzz")

      Calculated column:

      Calculated column = 
      SWITCH('Table'[Month],"January","xxx","February","yyy","zzz")

      Result is as below.

      Build a matrix visual and don't forget set show values in row in Format.

      If you want to show result as you show above, you may need to build measures for each month.

       

      Best Regards,

      Rico Zhou

       

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

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi MiraAnniina 

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

     

    Best Regards,

    Rico Zhou