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

Create a measure from a variable table

Good afternoon,

 

I am not able to complete one of my needed measures. 

 

My direct query table contains this structure:

userssteps
1NEW
1NEW
1NEW
2OLD
2OLD
3OLD
4EQUAL
5EQUAL
6EQUAL

 

I need a measure to distincount the number of users that has 3 times "NEW" in the "step" column. 

 

I am not able to create a calculated column because I am working with Direct Query. 

 

Right now, the furthest that I have got is creating a variable table where seems like this:

VAR tabla = 

ADDCOLUMNS(VALUES(table[users]),"nº values", CALCULATE(COUNT(table[steps]),segment_flatten[event] = "NEW")
usersnº values = NEW in steps
13
20
30
40
50
60

 

I would like to have this measure to be equal = 1 

 

Thank you in advance 🙂

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Count the number of rows where "nº values" is three or greater.

 

COUNTROWS ( FILTER ( tabla, [nº values] >= 3 ) )

 

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please try the below for creating a new table.

 

Picture3.png

 

VAR Tables =
ADDCOLUMNS (
VALUES ( 'Table'[users] ),
"@values",
CALCULATE ( DISTINCTCOUNT ( 'Table'[users] ), 'Table'[steps] = "NEW" ) + 0
)

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thanks for your quick answer Jihwan.

 

The thing here is that I didn´t want to create a new table, just a variable table.

 

Thank you anyways 🙂

AlexisOlson
Super User
Super User

Count the number of rows where "nº values" is three or greater.

 

COUNTROWS ( FILTER ( tabla, [nº values] >= 3 ) )

 

Anonymous
Not applicable

🤣🤣🤣I just want to scream 

 

I've been toying with several options, I didn't think about this possibility. 

 

Thanks a lot.

There are plenty of other ways to do it too. E.g.

SUMX ( tabla, IF ( [nº values] >= 3, 1, 0 ) )

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.