Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there,
I would ike to creat a column naming specific date ranges in order to create a filter afterwards. Right now I have set up the follwing IF-statement but it is rather a long formula, specifically if I want to add more weekly periods afterwards:
Date Range = IF('[DimDate] = DATE(2017;06;22);"22.-28.06";IF(''[DimDate] = DATE(2017;06;23);"22.-28.06";IF('[DimDate] = DATE(2017;06;24);"22.-28.06";IF('[DimDate] = DATE(2017;06;25);"22.-28.06";IF('[DimDate] = DATE(2017;06;26);"22.-28.06";IF('[DimDate] = DATE(2017;06;27);"22.-28.06";IF('[DimDate] = DATE(2017;06;28);"22.-28.06";"")))))))
Is there a way of doing it in a 'smarter' way? I am quite new to DAX...
Thanks
P
Solved! Go to Solution.
Hi @pippo80,
I can use measure:
Date Range = IF([DimDate] >= DATE(2017;06;22) && [DimDate] <= DATE(2017;06;28);"22.-28.06";"")))))))
Hi @pippo80,
You can also use the SWITCH function to add a date range column to you table in this scenario. The formula below is for your reference.
Date Range = SWITCH ( TRUE (); [DimDate] >= DATE ( 2017; 07; 22 ) && [DimDate] <= DATE ( 2017; 07; 25 ); "22.-28.07"; // Just need add a new condition row to add more weekly periods [DimDate] >= DATE ( 2017; 06; 22 ) && [DimDate] <= DATE ( 2017; 06; 28 ); "22.-28.06"; "others" )
Regards
Hi @pippo80,
You can also use the SWITCH function to add a date range column to you table in this scenario. The formula below is for your reference.
Date Range = SWITCH ( TRUE (); [DimDate] >= DATE ( 2017; 07; 22 ) && [DimDate] <= DATE ( 2017; 07; 25 ); "22.-28.07"; // Just need add a new condition row to add more weekly periods [DimDate] >= DATE ( 2017; 06; 22 ) && [DimDate] <= DATE ( 2017; 06; 28 ); "22.-28.06"; "others" )
Regards
Hi @pippo80,
I can use measure:
Date Range = IF([DimDate] >= DATE(2017;06;22) && [DimDate] <= DATE(2017;06;28);"22.-28.06";"")))))))
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
68 | |
43 | |
34 | |
26 |
User | Count |
---|---|
86 | |
50 | |
45 | |
38 | |
38 |