Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

How to set a column into a variable ?

Hi in my previous report they were using caluclated column, that was used in multiple charts, But performence wise it will take time to show the visual. Now i want to change that caluclated column into measure .

i tried multiple ways but wont work. it showing some errors.

This is the caluclated column .

 

LOB =
VAR PROJ='Wiser Jira Mapping'[Wiser Instance & solution mapping to Jira project]

VAR CAT=CALCULATE(MAX(DimProjects[CATEGORY])
,FILTER(ALL(DimProjects),DimProjects[NAME]=PROJ))

RETURN
IF(CAT=BLANK(),"NA",CAT)
 
Please let me know the solution if you found anything.
Thanks in advance

5 Replies

  • try like this:

    LOB =
    VAR PROJ=
            CALCULATE(
                    MAX('Wiser Jira Mapping'[Wiser Instance & solution mapping to Jira project]))
    
    VAR CAT=CALCULATE(MAX(DimProjects[CATEGORY])
    ,FILTER(ALL(DimProjects),DimProjects[NAME]=PROJ))
    
    RETURN
    IF(CAT=BLANK(),"NA",CAT)

     

    LOB =
    VAR PROJ=
            MAX('Wiser Jira Mapping'[Wiser Instance & solution mapping to Jira project])
    
    VAR CAT=CALCULATE(MAX(DimProjects[CATEGORY])
    ,FILTER(ALL(DimProjects),DimProjects[NAME]=PROJ))
    
    RETURN
    IF(CAT=BLANK(),"NA",CAT)

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ahmed,

      Its working 
      but while iam using in matrix(Rows) it wont take the measure 
      how can i set it into matrix in ROws section

      • sevenhills's avatar
        sevenhills
        Super User

        Try and see if this works, by only replacing this line (and keep the rest of the measure code)

         

         

        VAR PROJ=
                SELECTEDVALUE('Wiser Jira Mapping'[Wiser Instance & solution mapping to Jira project])