Power BI · मराठी आवृत्ती
8.3 Custom Column
Sample data definition: या course च्या Orders[Amount] मध्ये discount आधीच वजा आहे. खाली Amount − Discount हे generic formula शिकवण्यासाठीचं example आहे; आपल्या sample वर पुन्हा discount वजा करू नका. Sample Net Sales = SUM(Orders[Amount]); discountपूर्व gross = Amount + Discount.
प्रत्येक row साठी स्वतःचं M expression लिहायचं असेल तर Custom Column वापरा.
- Add Column › Custom Column निवडा.
- नाव Net Amount द्या.
- Available columns मधून fields insert करून
[Amount] - [Discount]लिहा. - No syntax errors message तपासा आणि OK करा.
- ABC123 म्हणजे Any type राहिल्यास header type icon मधून Fixed Decimal Number द्या.
= Table.AddColumn(Source, "Net Amount", each [Amount] - [Discount], Currency.Type)
// more examples
each [Amount] + [Delivery Fee] // Order Line Total
each if [Payment Mode] = "Cash on Delivery" then "Cash" else "Digital"
each Text.Upper(Text.Start([City], 3)) & "-" & [Area] // "PUN-Kothrud"
each Date.DayOfWeekName([Order Date], "en-IN") // "Monday"
Code मध्ये Payment Mode group, City prefix आणि day name चे examples आहेत. Null discount चा अर्थ no discount असेल तर [Amount] - ([Discount] ?? 0) वापरू शकता.
Practice
Amount + Delivery Fee − Discount असा sample line total करा; null Discount हाताळा. Delivery Fee order-level असून प्रत्येक product row वर repeat असेल तर प्रत्येक line ला जोडू नका. आधी योग्य grain वर fee एकदाच मोजा.