Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

use DAX to create a new table or column

 I need to add two fileds, or may be a new table to be created

null_0-1653376077744.png

 

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

Do you have any ideas? Thank you.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

If your purpose is to display a visual with month and sum(request_headcount) columns, you can first add a month column to the table with month = FORMAT('Table'[sorted_onboard_date],"yyyymm")

vjingzhang_0-1653617273154.png

 

Then create a table visual to the report. Drag month and request_headcount to the table visual. Right click on request_headcount and select Sum for it. In the same way select Don't summarize for month. 

vjingzhang_1-1653617445679.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

If your purpose is to display a visual with month and sum(request_headcount) columns, you can first add a month column to the table with month = FORMAT('Table'[sorted_onboard_date],"yyyymm")

vjingzhang_0-1653617273154.png

 

Then create a table visual to the report. Drag month and request_headcount to the table visual. Right click on request_headcount and select Sum for it. In the same way select Don't summarize for month. 

vjingzhang_1-1653617445679.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , Do you need somhing like that

 

This Month Today =
var _min = eomonth(today(),-1)+1
var _max = eomonth(today(),0)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

Last Month Today =
var _min = eomonth(today(),-2)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

refer

https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27304

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors