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
nareshr89
Helper II
Helper II

Fetch output for a column having text with filters applied using DAX

Hi All, 

 

I have a table that contains comments being added to it based on the monthload.

Want to write a measure that can ouput the comment using filter conditions included in the DAX rather than filters.

nareshr89_0-1669822907698.png

Ex: Something like -

var yr = selectedvalue(T2(year))

var ml = selectedvalue(T2(monthload))

Return

Calculate(Comments, Year=yr,Monthload=ml)

 

Here the year and Monthload will be selected from a dimension table so want the measure to slice the data in fact table using the year & monthload values provided from Dimension table. @tamerj1 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @nareshr89 ,

 

You can create a measure as below.

 

Filter = 
VAR _YR =
    SELECTEDVALUE ( 'Calendar'[Year] )
VAR _ML =
    SELECTEDVALUE ( 'Calendar'[Monthload] )
RETURN
    IF ( MAX ( 'Table'[Year] ) = _YR && MAX ( 'Table'[MonthLoad] ) = _ML, 1, 0 )

 

Add this measure into visual level filter and set it to show items when value = 1.

Result is as below.

RicoZhou_0-1669863655015.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @nareshr89 ,

 

You can create a measure as below.

 

Filter = 
VAR _YR =
    SELECTEDVALUE ( 'Calendar'[Year] )
VAR _ML =
    SELECTEDVALUE ( 'Calendar'[Monthload] )
RETURN
    IF ( MAX ( 'Table'[Year] ) = _YR && MAX ( 'Table'[MonthLoad] ) = _ML, 1, 0 )

 

Add this measure into visual level filter and set it to show items when value = 1.

Result is as below.

RicoZhou_0-1669863655015.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors