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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mav
New Member

Take value from column and fill new column based on condition

Hello,

I'm trying to build a column that is filled with the value from another column.

Fill the column with the total income for that particular month

(For clarity, the value would change depending on the month)

 

Any suggestions?

 

revformonth.png

1 ACCEPTED SOLUTION

Hi,

try the below whether it works for your dataset.

If you have more columns to be included in the condition, you can try to add more into the below by using && function.

Rev for month CC =
MAXX (
    FILTER (
        'your table name',
        'your table name'[acct] = "Total Income"
            && 'your table name'[month] = EARLIER ( 'your table name'[month] )
    ),
    'your table name'[value]
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

Based on what I see on the screenshot, please try the below for creating a new column.

 

Rev for month CC =
MAXX (
    FILTER ( 'your table name', 'your table name'[acct] = "Total Income" ),
    'your table name'[value]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thanks! We're close, but i need the Income to be displayed for the respective month.

Your code will populate the maximum value for all months.

 

ie.  for all Jan rows, i need Jan income, for Feb rows, I need Feb income etc.revformonth2.png

Hi,

try the below whether it works for your dataset.

If you have more columns to be included in the condition, you can try to add more into the below by using && function.

Rev for month CC =
MAXX (
    FILTER (
        'your table name',
        'your table name'[acct] = "Total Income"
            && 'your table name'[month] = EARLIER ( 'your table name'[month] )
    ),
    'your table name'[value]
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Excellent - Thank you! Exactly what I was looking for.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors