Skip to main content
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.

Frequent Visitor

Dynamic Columns Selection in SUMMARIZECOLUMNS based on user selection parameter

Hello All,

I need to create a dataset in Power Builder :.

I have two fact tables (Fact_Monthly et Fact_Weekly)

I have a parameter (@Period) with values (Monthly, Weekly)


I want to execute the SUMMERIZCOLUMNS based on user seletion

If user entered ="Monthly" =>get columns from Fact_Monthly
If user entered ="Weekly" =>get columns from Fact_Weekly
Here's my code



	VAR __DS0FilterTable1 = 
		TREATAS({@Period}, 'Calender'[Période])


IF(@Period="Monthly",//i also tried IF(__DS0FilterTable1="Monthly",
		'Group'[Code Group],

		'Group'[Code Group],


But the __DS0FilterTable1 return a table not a unique value! So i can't compare it with a text in my IF statment !

And i get the error  : The expression refers to multiple columns... cannot be converted to a scalar value

Some help on how can i get the entered value ("Montly" or "Weekly") in the my parameter please !!

Frequent Visitor

Thanks @some_bih !

I tried with query builder, it's always the same problem : getting a table result instead of unique text value !



the question is how can get the value (1) to compare it with the string (2) (monthly or weekly in english) ?


PS : the DAX of the measure SELECTEDITEM in my Power BI report is :

//get selected period (Monthly or Weekly)


Hi @Abh_90 "I have two fact tables", in DAX Studio, tables should be connected "properly" to leverage feature DAX builder (or any other functions/tool...). I do not details about your model.

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

Proud to be a Super User!

Super User
Super User

Hi @Abh_90 I recognize you use DAX Studio.

In DAX Studio, there is query builder to help with your case, check link 

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

Proud to be a Super User!

Helpful resources

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


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