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
DC_ZA
New Member

SELECTEDVALUE returns blank in column but is populated when added to card

I have a table in PowerBI with a monthstring column (YYYYMM), I use this in a filter so the datatype is set as 'text', I created a measure using SELECTEDVALUE to return the monthstring that is selected in the filter. When I add this measure in a card, it returns the correct value and also changes as I change the selection.

 

X_SelectedMonthstring = SELECTEDVALUE(Dim_FilterMonthString[Monthstring])
 
The problem comes in when I want to use this measure in another column, say for instance to add a column with a flag (1 or 0) to indicate the selected monthstring in a table, it is only returning 1 for all fields.
 
Measure: X_SelectedMonthstring = SELECTEDVALUE(Dim_FilterMonthString[Monthstring])
 
Column: X_MonthString_Flag = IF(Dim_FilterMonthString[MonthString]=[X_SelectedMonthstring],1,0)
Column: X_TestString = SELECTEDVALUE(Dim_FilterMonthString[MonthString])
 
card.JPGtable.JPG
 
If I change the column formula to be a fixed value I get the desired results:
Column: X_MonthString_Flag = IF(Dim_FilterMonthString[MonthString]="202106",1,0)table2.JPG
1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@DC_ZA 

i don't think the slicer can affect a calculated column. You need to have a measure solution





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@DC_ZA 

i don't think the slicer can affect a calculated column. You need to have a measure solution





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thank you, I skipped using the flag column all together and used my measure directly in my second measure and it worked. 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.