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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Anonymous
Not applicable

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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

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)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.