Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Aruljoy
Helper II
Helper II

Selected column function for measure

Hi All,
 
I want to create a new data set based on existing using selected columns. 
 
Test1 = SELECTCOLUMNS(TransactionData,"MemberID",TransactionData[MemID],"FailOnlyFlag",COUNTROWS ( FILTER ( VALUES ( 'TransactionData'[MemID] ) , [Measure_SuccessCount] = 0 ) ))

 

[Measure_SuccessCount] = 

CALCULATE(countrows(TransactionData),FILTER(TransactionData,TransactionData[TransactionTypeDerived]="success"))
 
getting the following error "Aruljoy_1-1646252557612.png"
 
Can anyone help me how to achieve this?
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Aruljoy ,

 

Please try using below formula to create a new table.

test1 =
var _count = CALCULATE(countrows(TransactionData), FILTER(TransactionData, TransactionData[TransactionTypeDerived]="success"))
return
SELECTCOLUMNS(TransactionData, "MemberID", TransactionData[MemID], "FailOnlyFlag", calculate(COUNTROWS('TransactionData'), Filter(ALLEXCEPT(TransactionData, TransactionData[MemID]), _count=0)))

 

Best Regards,

Jay

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

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Aruljoy ,

 

Please try using below formula to create a new table.

test1 =
var _count = CALCULATE(countrows(TransactionData), FILTER(TransactionData, TransactionData[TransactionTypeDerived]="success"))
return
SELECTCOLUMNS(TransactionData, "MemberID", TransactionData[MemID], "FailOnlyFlag", calculate(COUNTROWS('TransactionData'), Filter(ALLEXCEPT(TransactionData, TransactionData[MemID]), _count=0)))

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Aruljoy , This should be create as table, you are creating as measure

Test1 = SELECTCOLUMNS(TransactionData,"MemberID",TransactionData[MemID],"FailOnlyFlag",COUNTROWS ( FILTER ( VALUES ( 'TransactionData'[MemID] ) , [Measure_SuccessCount] = 0 ) ))

 

Slicer values will not work with calculated table , better create a var in measure

 

Test1 =

var _tab = SELECTCOLUMNS(TransactionData,"MemberID",TransactionData[MemID],"FailOnlyFlag",COUNTROWS ( FILTER ( VALUES ( 'TransactionData'[MemID] ) , [Measure_SuccessCount] = 0 ) ))

return

countrows(_tab)

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.