Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am a new DAX user, I want to konw that how to create a table to make a calculation and a dimension column, the new table should also consider the context, for example create a calculation that show the minmium day of expected_report_date column from original table and a new column with month number of the previous month,for examle two value in expected_report_dateis '1/5/2022' and '3/5/2022', the new table I want is:
min_date previous_month
1/5/2022 4
Solved! Go to Solution.
Hi @Anonymous ,
I created some data:
Here are the steps you can follow:
1. Create calculated column.
Month = YEAR('Table'[Sorted_onboard_date])&""&FORMAT('Table'[Sorted_onboard_date],"mm")
sum(request_headcount) =
SUMX(FILTER(ALL('Table'),'Table'[Month]=EARLIER('Table'[Month])),[request_headcount])
2. Create calculated table.
Table 2 =
SUMMARIZE('Table','Table'[Month],'Table'[sum(request_headcount)])
3. Result:
If you need pbix, please click here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Anonymous ,
I created some data:
Here are the steps you can follow:
1. Create calculated column.
Month = YEAR('Table'[Sorted_onboard_date])&""&FORMAT('Table'[Sorted_onboard_date],"mm")
sum(request_headcount) =
SUMX(FILTER(ALL('Table'),'Table'[Month]=EARLIER('Table'[Month])),[request_headcount])
2. Create calculated table.
Table 2 =
SUMMARIZE('Table','Table'[Month],'Table'[sum(request_headcount)])
3. Result:
If you need pbix, please click here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Anonymous , You can datediff of the two date in a new column
datediff([Date1],[Date2], day)
If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
thanks, the requirement is need to add two fileds not one field, or may be a new table to be created
here is the original data,
I need two column: sum(request_headcount) when month(sorted_onboard_date) = 202205 and 202205,
sum(request_headcount) when month(sorted_onboard_date) = 202204 ,202204
sum(request_headcount) when month(sorted_onboard_date) = 202205 ,202203
namely, I need to three values based on month(today) and return 2 columns to be shown to creat a visual:
month, sum(request_headcount)
202205 13
202204 23
202203 16