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
Szokens
Helper I
Helper I

Different column output basing on Parameter Selection

Hi Guys and Welcome Everyone! my first post in this community :).

 

I have following query. I have created parameter using "New Parameter" -> "Numeric Range"

Szokens_0-1728903874194.png

 

Then I have edited parameter settings as follows:

Szokens_1-1728903931885.png

 

Szokens_4-1728904065266.png

 

Szokens_3-1728904026814.png

 

Then I would like to have column with different output depending on parameter selection. I wrote formula as follows:

Szokens_5-1728904273183.png

 

When I test it in report view, I always get "NOTPASSED", whatever I choose in the slicer. Do I miss anything or is there other workaround to achieve my goal?

Szokens_6-1728904495893.png

 

 

1 ACCEPTED SOLUTION
Szokens
Helper I
Helper I

Hi, my use case here required different solution. @Anonymous  thanks for this calculation I believe I will utilized it in the future. However here I got all values in one row which is not what I need.

Instead of this, I have created separate columns with calculations for day / week / month / quarter / year. Following this I have prepared separate vizuals with my required metric "Sends" (not mentioned before) on Y axis and on X axis I put my new column one by one separately for each vizual. Then I have used method described in following article to display my metric in different time-frame using buttons and bookmarks .

 

https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive 

View solution in original post

7 REPLIES 7
Szokens
Helper I
Helper I

Hi, my use case here required different solution. @Anonymous  thanks for this calculation I believe I will utilized it in the future. However here I got all values in one row which is not what I need.

Instead of this, I have created separate columns with calculations for day / week / month / quarter / year. Following this I have prepared separate vizuals with my required metric "Sends" (not mentioned before) on Y axis and on X axis I put my new column one by one separately for each vizual. Then I have used method described in following article to display my metric in different time-frame using buttons and bookmarks .

 

https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive 

Szokens
Helper I
Helper I

I have tried both solutions and I am facing following issue when putting my calculation into measure (formula changed a bit following instructions given by @gaurav-lakhotia , but putting original claculation into measure gives the same error):

Szokens_0-1728913731664.png

 

to make it works, I need to put each "sent_date" into ie. MAX() function for example but this doesn't give me required result - only one value (screenshot below) but my use case is to get list of all possible values...

Szokens_2-1728914823988.png

 

What I would like to achieve here actually is changing dimension, as I will use MMD2 in colum of my future viz, so dimension will change when making selection in parameter.

Anonymous
Not applicable

Hi @Szokens ,

 

The measure will return summarize result, so when you only add the measure into the table, it will only give you an aggregated value. And you need to use SUM()/MAX()/MIN() to get data in measure.

Here I suggest you to add [sent_date] column in to the table visual as well. Then you table visual will contain two value, [sent_date] and [Parameter measure]. The measure will return results based on your column. If the measure logic is correct, you will get you want.

 

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.

 

 

 

Hi @Anonymous thanks for suggestion, indeed when adding [send_date] as a dimension here, my measure is broken down and I see more than 1 result. Issue is that I see duplicates.

But my goal is to have after each selection in slicer ie "Monthly" distinct values in my table.

So for "Monthly" it will be two values "Mar'24" and "Apr'24".

For "Weekly" it will be two values "Week 13, 24" and "Week 14, 24".

It might be tuff to do it with "measure" field which need an aggregation.

Szokens_0-1729073405811.png

 

Anonymous
Not applicable

Hi @Szokens,

 

I suggest you to try code as below to update your measure.

Parameter_TEST_MMD2_table_measure =
VAR _SUMMARIZE =
    SUMMARIZE (
        Merged_Prod_Query,
        [sent_date],
        "Dynamic",
            SWITCH (
                [SelectMeasure],
                1,
                    CONVERT ( MONTH ( 'Merged_Prod_Query'[sent_date] ), STRING ) & "/"
                        & CONVERT ( DAY ( Merged_Prod_Query[sent_date] ), STRING ) & "/"
                        & CONVERT ( YEAR ( 'Merged_Prod_Query'[sent_date] ), STRING ),
                2,
                    "Week " & CONVERT ( WEEKNUM ( Merged_Prod_Query[sent_date] ), STRING ) & ", "
                        & RIGHT ( CONVERT ( YEAR ( Merged_Prod_Query[sent_date] ), STRING ), 2 ),
                3,
                    LEFT ( CONVERT ( FORMAT ( Merged_Prod_Query[sent_date], "mmm" ), STRING ), 3 ) & " '"
                        & RIGHT ( CONVERT ( YEAR ( Merged_Prod_Query[sent_date] ), STRING ), 2 ),
                4,
                    "Q" & CONVERT ( QUARTER ( Merged_Prod_Query[sent_date] ), STRING ) & " '"
                        & RIGHT ( CONVERT ( YEAR ( Merged_Prod_Query[sent_date] ), STRING ), 2 ),
                "NOTPASSED"
            )
    )
VAR _DISTINCT =
    SUMMARIZE ( _SUMMARIZE, [Dynamic] )
RETURN
    CONCATENATEX ( _DISTINCT, [Dynamic], " , " )

Result is as below.

vrzhoumsft_0-1729133161259.png

vrzhoumsft_1-1729133175156.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.

 

 

 

ValtteriN
Super User
Super User

Hi,

The issue is that you are trying to use this as a column. If you place the dax into a measure your logic should work. I re-created this with test values:

Parameter = DATATABLE("a",STRING,{{"a"},{"b"}})
Measure 31 = SWITCH([Parameter Value],"a",1,3)

ValtteriN_0-1728906726251.png

 

On a separate note what you are doing here doesn't really have anything to do with parameters. While you created the template for your calculated table and SELECTEDMEASURE calculation with it this is a separate topic.


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




Hi @Szokens,

Instead of creating parameter, create table using Enter Data. Do not create any relationship for that table. Just put the column from Enter data table in a slicer. Apply business logic in a measure using SWITCH funtion.


https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slic...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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