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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
viferenc
Helper II
Helper II

Take the first data entry from specific columns

Dear All,

 

I would like to ask for your help, becasue I was not able to figure out how the following issue could be solved with DAX formula. 

 

I have the table below (the table has several other columns), where you can see in the column the monthly cost of sales for different products.

I would like to calculate the cost of sales increase in the following way.

COS increase = Dec COS divided by the first cost of sales entry 

Example 

  • 1st line: 14,93/14,65
  • 2nd line: 8,26/8,01

Is there any Dax formula which could give me back the first entry in a row? (but only in aspect of the specific columns, as the table contains several other colums)

 

viferenc_0-1633794689365.png

 

Thank you very much for your help.

 

Best regards

 

Feri

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@viferenc 

Agree with @YukiK , unpivoting and building your model would be the best approach but if you want to do the calculation based on your existing model, then add a new column to your table as I have shown in the example below, I added just three months but you can include all 12 months.

1st Value = 
DIVIDE(
    FIRSTNONBLANK( {[Oct COS],[Nov COS],[Dec COS]} , [Value] ),
    [Dec COS]
)



Fowmy_0-1633810206894.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @viferenc ,

 

You can create an index column and then create a measure similar to the following

 

Column = CALCULATE(MAX('Table'[Column1]),FILTER(ALL('Table'),[Index]=1))

 

6.png

 

How to add an index column:

https://docs.microsoft.com/en-us/power-query/add-index-column

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@viferenc 

Agree with @YukiK , unpivoting and building your model would be the best approach but if you want to do the calculation based on your existing model, then add a new column to your table as I have shown in the example below, I added just three months but you can include all 12 months.

1st Value = 
DIVIDE(
    FIRSTNONBLANK( {[Oct COS],[Nov COS],[Dec COS]} , [Value] ),
    [Dec COS]
)



Fowmy_0-1633810206894.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

YukiK
Impactful Individual
Impactful Individual

What does each row represent? I was thinking we can upivot the columns into rows, and use something like FIRSTNONBLANK() function. The way the table is set up doesn't seem to be the best way to handle this

Each row represents a product and the row shows the monthly development of the cost of sales.

YukiK
Impactful Individual
Impactful Individual

Not sure how big of your table is, but I'd unpivot it so that the table will have product, month, and value (COS) columns. And from there, you'd be able to leverage functions like FIRSTNONBLANK() and LASTNONBLANK(). If you have sample data to share, I could further investigate what should be done.

 

Hope this helps!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors