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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
STIBBS_807
Resolver I
Resolver I

Create a Measure from Direct Query Connection

I am new to Direct Query on data. I would like to create a measure for an item within a folder of the table.

 

Table format:

Case Table

    Item One

    Item Two

    Folder One

        Folder One Item One

        Folder One Item Two

 

The measure that I am trying to create.

ItemLen = len('Case Table'[Folder One Item Two])

This does not work. I tried this next.

ItemLen = len('Case Table''Folder One'[Folder One Item Two])

This does not work.  

ItemLen = len('Case Table','Folder One',[Folder One Item Two])

This does not work.  

ItemLen = len('Case Table'.'Folder One'.[Folder One Item Two])

This does not work.  

 

I need help with writing this measure.  Thank you.

 

1 ACCEPTED SOLUTION

HI @STIBBS_807 ,

 

Folder is just a display view within your CASES table.

I think the problem here is the DAX function that you are using.

 

LEN function returns the length of a text value. Here you are trying to apply it directly on a column which is wrong. This LEN function works on a single text value.

You can read more details about this function here:

https://learn.microsoft.com/en-us/dax/len-function-dax

 

If you want to use this function on a column, you will have to use an agrregation on your column before applying LEN dax function to it.

Something like this below:

 

 

test = LEN(MAX('Countries emissions'[CO2 Emission Type]))

 

 

 

Hope this helps.

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

4 REPLIES 4
Pragati11
Super User
Super User

Hi @STIBBS_807 ,

 

I don't understand th format of your tables. Can you elaborate more?

What do you mean by "measure for an item within a folder of the table"?

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Here is the table and the folder I am trying to get to:

STIBBS_807_1-1731531872764.png

I want to get the length of the Case Owner Team item to figure out where to truncate the first four characters off the word.

 

So my formula is: right(Case Owner Team, (len(Case Owner Team)-4))

STIBBS_807_0-1731531574074.png

Here is the Data folder in Power BI.  See the folder in the list.

HI @STIBBS_807 ,

 

Folder is just a display view within your CASES table.

I think the problem here is the DAX function that you are using.

 

LEN function returns the length of a text value. Here you are trying to apply it directly on a column which is wrong. This LEN function works on a single text value.

You can read more details about this function here:

https://learn.microsoft.com/en-us/dax/len-function-dax

 

If you want to use this function on a column, you will have to use an agrregation on your column before applying LEN dax function to it.

Something like this below:

 

 

test = LEN(MAX('Countries emissions'[CO2 Emission Type]))

 

 

 

Hope this helps.

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.