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
Birinder
Helper III
Helper III

How to create a conditional column through measures ?

Hi there, 

I hope you all are doing good,

 

Actually I am working on a Live data connected to Azure servers. Instead of importing it, I am working lively with it. But I need to create an extra field which will serve as a conditonal column. I can create a conditional column with Power Query, but for that I'll have to import the data. The datasets are pretty huge in size and exceeds the limit of threshold size. Further to add, I want to create a column, based on conditions, from tables which are all seperate and connected to each other via keys relationship. 

So how can I create a conditional column based on all the above info.

Here is a little example of what I want.

Roll 5Roll vEVM_ROLLIS&BS AmountDESIRED SOLUTION
1110Opening BalanceR11020000020000
1113Closing BalanceR222030000030000

 

The desired solution is the column I want. If Roll 5 = 1110 and Roll v = Opening Balance and EVM_ROLL = R110 then IS&BS AMOUNT else 0

Where,

Roll 5 is from table 'Legal_entity'

Roll v is from table 'Legal Entity (d)'

EVM_ROLL is from table 'Substitution Group'

IS&BS Amount is from table 'Facts_IS_BS'

 

I'm badly stuck at this.

Please help me if this is possible.

 

Thanks and Regards.

1 ACCEPTED SOLUTION

Hi @Birinder ,

It seems that you are connecting to Azure servers in live connection mode, in which case you cannot create calculated column, but only report-level measures. You can learn more about live connection by reviewing the following blog.

Live Connection; When Power BI comes Hybrid

You can create a table visual and put all these fields(Roll 5,Roll v,EVM_ROLL and IS&BS Amountin the Values options of table visual. Note that you should not use any aggregation functions for the value fields(like the field IS&BS Amount) as shown below screenshot. Also, you can create a measure as follows to get the ”desired column".

DESIRED SOLUTION = 
IF (
    SELECTEDVALUE ( 'Table'[Roll 5] ) = 1110
        && SELECTEDVALUE ( 'Table'[Roll v] ) = "Opening Balance"
        && SELECTEDVALUE ( 'Table'[EVM_ROLL] ) = "R110",
    SELECTEDVALUE ( 'Table'[IS&BS Amount] ),
    0
)

yingyinr_0-1639558459324.png

Best Regards

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

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Birinder , You can not create a column on measures, because slicer value will not be taken by measure, so that would be like static

So is there any other way ?

@AlexisOlson @Greg_Deckler 

 

 

@Birinder , a measure like

Switch( True ,
max(Table[Roll 5]) = 1110 && Max(Table[Roll v]) = "Opening Balance" && max(Table[EVM_ROLL]) = "R110", table[IS&BS AMOUNT] , 0
blank()
)

 

or

 

sumx(Summarize(Table, Table[Roll 5],Table[Roll v], Table[EVM_ROLL] , "_1", Switch( True ,
max(Table[Roll 5]) = 1110 && Max(Table[Roll v]) = "Opening Balance" && max(Table[EVM_ROLL]) = "R110", table[IS&BS AMOUNT] , 0
blank()
)), [_1])

@amitchandak 

The first command is showing me error :

"
MdxScript(Model) (37, 441) Function 'SWITCH' does not support comparing values of type True/False with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values.

 

and in the second solution,

after summarize opened bracket, "table" refers to which table? Which table name should I give here. You can answer by following the names of table I gave you above. 

 

Thanks for your support this far. I really appreciate the help.

Hi @Birinder ,

It seems that you are connecting to Azure servers in live connection mode, in which case you cannot create calculated column, but only report-level measures. You can learn more about live connection by reviewing the following blog.

Live Connection; When Power BI comes Hybrid

You can create a table visual and put all these fields(Roll 5,Roll v,EVM_ROLL and IS&BS Amountin the Values options of table visual. Note that you should not use any aggregation functions for the value fields(like the field IS&BS Amount) as shown below screenshot. Also, you can create a measure as follows to get the ”desired column".

DESIRED SOLUTION = 
IF (
    SELECTEDVALUE ( 'Table'[Roll 5] ) = 1110
        && SELECTEDVALUE ( 'Table'[Roll v] ) = "Opening Balance"
        && SELECTEDVALUE ( 'Table'[EVM_ROLL] ) = "R110",
    SELECTEDVALUE ( 'Table'[IS&BS Amount] ),
    0
)

yingyinr_0-1639558459324.png

Best Regards

Community Support Team _ Rena
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.