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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
gheecalipes25
Resolver I
Resolver I

Create a column with Conditions

Hi,

 

I would like to seek assistance on how to create a calculation for the below.

 

I wanted to create a calculated column with the below conditions:

 

Recurrent Amount = Amount * 12
if
Unique count = Yes
Recurrency = Recurrent
Status Description = Cancelled, Hold
Date Approved = Not Approved
Period = Monthly, Monthly(Per-User)

 

Thank you so much for the help. 🙂

3 ACCEPTED SOLUTIONS
Gabriel_Walkman
Continued Contributor
Continued Contributor

Hi there. A calculated column can be created either in DAX or in Transform Data (Power Query Editor). You posted this in the power query forum, but I'd suspect this would normally made in DAX.

If you'd like to do this in DAX, quick google gives me https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-calculated-columns...


If you'd like to do this in power query, it is very simple. You could create a conditional column and just plug in the requirements. https://radacad.com/conditional-column-in-power-bi-using-power-query-you-can-do-anything

 

View solution in original post

BA_Pete
Super User
Super User

Hi @gheecalipes25 ,

 

In Power Query M code:

if [Unique count] = "Yes"
  and [Recurrency] = "Recurrent"
  and List.Contains({"Cancelled", "Hold"}, [Status Description])
  and [Date Approved] = "Not Approved"
  and List.Contains({"Monthly", "Monthly(Per-User)"}, [Period])
then [Amount] * 12
else //your escape output, like null or 0

 

In DAX

_recurrentAmount =
IF(
  yourTable[Unique Count] = "Yes"
  && yourTable[Recurrency] = "Recurrent"
  && yourTable[Status Description] IN {"Cancelled", "Hold"}
  && yourTable[Date Approved] = "Not Approved"
  && yourTable[Period] IN {"Monthly", "Monthly(Per-User)"},
  yourTable[Amount] * 12,
  //your escape output, like null or 0
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

gheecalipes25
Resolver I
Resolver I

Thank you all.. 🙂

View solution in original post

3 REPLIES 3
gheecalipes25
Resolver I
Resolver I

Thank you all.. 🙂

BA_Pete
Super User
Super User

Hi @gheecalipes25 ,

 

In Power Query M code:

if [Unique count] = "Yes"
  and [Recurrency] = "Recurrent"
  and List.Contains({"Cancelled", "Hold"}, [Status Description])
  and [Date Approved] = "Not Approved"
  and List.Contains({"Monthly", "Monthly(Per-User)"}, [Period])
then [Amount] * 12
else //your escape output, like null or 0

 

In DAX

_recurrentAmount =
IF(
  yourTable[Unique Count] = "Yes"
  && yourTable[Recurrency] = "Recurrent"
  && yourTable[Status Description] IN {"Cancelled", "Hold"}
  && yourTable[Date Approved] = "Not Approved"
  && yourTable[Period] IN {"Monthly", "Monthly(Per-User)"},
  yourTable[Amount] * 12,
  //your escape output, like null or 0
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Gabriel_Walkman
Continued Contributor
Continued Contributor

Hi there. A calculated column can be created either in DAX or in Transform Data (Power Query Editor). You posted this in the power query forum, but I'd suspect this would normally made in DAX.

If you'd like to do this in DAX, quick google gives me https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-calculated-columns...


If you'd like to do this in power query, it is very simple. You could create a conditional column and just plug in the requirements. https://radacad.com/conditional-column-in-power-bi-using-power-query-you-can-do-anything

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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