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
Basmall_B
Frequent Visitor

Want to create a measure not a column with related values pulled from different tables

Hi 

I am making my transition from sql to DAX and is in the process of learning DAX syntax.

What I would like to do is to create  measure to show concatenated values from two different tables which are related from an Analysis server tabular model. The measure will show as a column in my table visual.  Adding a custom calculated column is not an option as I dont have rights to make changes to the Tabular model. 

I dont need this be done for all rows only for rows that have a data type "WaterQuality" 

Please see the attached sample table and data model

 

Here is what i am trying to achieve. select from table1 column, table 2 column  concat those columns based on a filter column in table 3 where data category = 'Water Quality'

 

Thank you for help in advance

SampleTable.png

Model.jpg

 

 

 

1 ACCEPTED SOLUTION

Wow thank you very much it works. I am almost close to the final desired output.

This is  what I ended up doing for a Measure

 

LocationSamples =
(
VAR SampleNames = CALCULATE ( VALUES ( DIMSAMPLENAME[SampleName] ), Fact_Readings )
VAR Locations = CALCULATE ( VALUES ( DimIntervals[INTERVAL_NAME] ), Fact_Readings )
Return
CONCATENATE( Locations, SampleNames)
)

 

I want to add a space or  comma using concatenate  in between the location and sample names and the visual comes up empty 

when I  nest the concatenate

 

CONCATENATE(Locations, CONCATENATE(", ", SampleNames))

 

I even tried "& &" since both the variables are returning strings . The version of powerbi that we have that is compatible with or OnPerm server doesnt have the new COMBINEVALUES function

Locations&" , "&SamplesNames

 

What am I missing here?

 

 

 

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Hi, @Basmall_B , based on your description and illustration, I'd obtain filtered columns this way,

SampleNames Filtered = CALCULATE ( VALUES ( DIMSAMPLENAME[SampleName] ), Fact_Readings )

Locations Filtered = CALCULATE ( VALUES ( DimLocation[LOCNAME] ), Fact_Readings )

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Wow thank you very much it works. I am almost close to the final desired output.

This is  what I ended up doing for a Measure

 

LocationSamples =
(
VAR SampleNames = CALCULATE ( VALUES ( DIMSAMPLENAME[SampleName] ), Fact_Readings )
VAR Locations = CALCULATE ( VALUES ( DimIntervals[INTERVAL_NAME] ), Fact_Readings )
Return
CONCATENATE( Locations, SampleNames)
)

 

I want to add a space or  comma using concatenate  in between the location and sample names and the visual comes up empty 

when I  nest the concatenate

 

CONCATENATE(Locations, CONCATENATE(", ", SampleNames))

 

I even tried "& &" since both the variables are returning strings . The version of powerbi that we have that is compatible with or OnPerm server doesnt have the new COMBINEVALUES function

Locations&" , "&SamplesNames

 

What am I missing here?

 

 

 

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.