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.
Hi,
I have a static table(table1) called date contain Month, Year, Quarter and then i would like to create a calculated column using that static table
DAX:
IF(Hasonevalue(table1), switch(values(table1), "Month", Year([Date]) & " " & Month([Date]), "Year", Year([Date]), "Quarter", Year([Date]) & " " & Quarter([Date]))
When user select month then the calculated column should show Yearmonth, If user select Quarter then Year Quarter.
Table1 | |
Month | |
Year | |
Quarter | |
If user select Month | |
Output | |
Calculated column | |
2020 01 | |
2020 02 | |
2020 03 | |
Then i will use that calculated column as slicer.
Thanks,
Solved! Go to Solution.
Hi,
Please try to create a calculated table:
Table 3 =
UNION (
SELECTCOLUMNS (
'Table 2',
"Date", FORMAT ( 'Table 2'[Date], "YYYY MM" ),
"Group", "Month"
),
SELECTCOLUMNS (
'Table 2',
"Date", FORMAT ( 'Table 2'[Date], "YYYY" ),
"Group", "Year"
),
SELECTCOLUMNS (
'Table 2',
"Date", FORMAT ( 'Table 2'[Date], "YYYY q" ),
"Group", "Quarter"
)
)
Choose this table's [Group] as one slicer for end user and this table's [Date] as another slicer for you to choose.
The result shows:
See my attached pbix file.
Best Regards,
Giotto
Hi,
Please try to create a calculated table:
Table 3 =
UNION (
SELECTCOLUMNS (
'Table 2',
"Date", FORMAT ( 'Table 2'[Date], "YYYY MM" ),
"Group", "Month"
),
SELECTCOLUMNS (
'Table 2',
"Date", FORMAT ( 'Table 2'[Date], "YYYY" ),
"Group", "Year"
),
SELECTCOLUMNS (
'Table 2',
"Date", FORMAT ( 'Table 2'[Date], "YYYY q" ),
"Group", "Quarter"
)
)
Choose this table's [Group] as one slicer for end user and this table's [Date] as another slicer for you to choose.
The result shows:
See my attached pbix file.
Best Regards,
Giotto
@Kumarcy , Check if this can help, how to use the slicer to have different formulas
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |