Forum Discussion
Different column output basing on Parameter Selection
- 1 year ago
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
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.
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.
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.