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
Anonymous
Not applicable

Calculate first transaction value

Hi!

I have different transaction. I would like to create a calculated column which calculates the first price of the transaction. As I showed in the desired column. What DAX measure do I need to use?

 

NameDatePriceTransactionIDPeriodIDDesired column
A1-1-201910Buy1110
A2-1-201912  110
A3-1-20198  110
A4-1-201915Sell1110
B1-6-2019150Buy22150
B2-6-2019101  2150
B3-6-2019105  2150
B4-6-201980  2150
B5-6-2019120  2150
B6-6-201999Sell22150
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous Here is the formula to get periodId wise min date price

Column = 
VAR minDate = CALCULATE(MIN('Fact'[Date]),ALLEXCEPT('Fact','Fact'[Name],'Fact'[PeriodID]))
RETURN CALCULATE(MAX('Fact'[Price]),FILTER(ALLEXCEPT('Fact','Fact'[PeriodID]),'Fact'[Date] = minDate))

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Anonymous 

Column = 
VAR minDate = CALCULATE(MIN('Fact'[Date]),ALLEXCEPT('Fact','Fact'[Name]))
RETURN CALCULATE(SUM('Fact'[Price]),FILTER(ALL('Fact'),'Fact'[Date] = minDate))
Anonymous
Not applicable

@Anonymous 

 

Hi! Thank you for response. My dummy data wasn't as clear as needed. In the name and date column, it's possible that the same value appears multiple times. Do you know how I can modify the formula, so I can get the desired column?

 

NameDatePriceTransactionIDPeriodIDDesired columnColumn with current measure
A1-1-201910Buy111010
A2-1-201912  11010
A3-1-20198  11010
A4-1-201915Sell111010
B1-6-2019150Buy22150200
B2-6-2019101  2150200
B3-6-2019105  2150200
B4-6-201980  2150200
B5-6-2019120  2150200
B6-6-201999Sell22150200
A1-6-201950Buy335010
A2-6-201955  35010
A3-6-201970  35010
A4-6-201960Sell335010
Anonymous
Not applicable

@Anonymous Here is the formula to get periodId wise min date price

Column = 
VAR minDate = CALCULATE(MIN('Fact'[Date]),ALLEXCEPT('Fact','Fact'[Name],'Fact'[PeriodID]))
RETURN CALCULATE(MAX('Fact'[Price]),FILTER(ALLEXCEPT('Fact','Fact'[PeriodID]),'Fact'[Date] = minDate))

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.