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
Enric21
Frequent Visitor

Get sales value from latest version of a project by chapters

Hi Legends,

 

I got answered by @v-jingzhang (Many thanks) on a previous post how to get the total amount of a project but now I am struggling trying to get the result by chapters. I need a Dax method to do so.

 

The point is, my table in addition to projects it also has chapters, so each project has many chapters. To do the table with total amounts per project I did: 

Table 2 = SUMMARIZE('Table','Table'[Project ID],"Version",MAX('Table'[Version]))

Then add a new column in this table 

Sales = SUMX(FILTER('Table','Table'[Project ID]='Table 2'[Project ID]&&'Table'[Version]='Table 2'[Version]),'Table'[Sales])

Enric21_0-1635840471447.jpeg

 

 

As I mentioned before that table gave me the total amount of the latest version of each project as I asked for, but now I would like to know how to make that table (or another one) taking into account the chapters as well. So as an example the original table is like: 

 

Project IDVersionChapterSales
1001.0110
1001.0115
1101.0115
1101.0220
1101.0215
1201.0130
1201.0130
1201.0250
2001.0120
2001.0220
2101.01100
2101.0240
2101.0270

 

And the result I would like to get would be like: 

 

Project IDVersionChapterSales
1201.0160
1201.0250
2101.01100
2101.02110

 

Thank you very much in advance

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Enric21 

 

Try this measure :

Sale_m =
VAR _version =
    CALCULATE(
        MAX( 'Table'[Version] ),
        ALLEXCEPT( 'Table', 'Table'[Project ID] )
    )
RETURN
    CALCULATE( SUM( 'Table'[Sales] ), FILTER( 'Table', [Version] = _version ) )

drag these fields in the table visual but replace the Sale with above measure.

And the result:

vchenwuzmsft_0-1636010958901.png

I put my pbix file in the attachment you can refer.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

View solution in original post

3 REPLIES 3
v-chenwuz-msft
Community Support
Community Support

Hi @Enric21 

 

Try this measure :

Sale_m =
VAR _version =
    CALCULATE(
        MAX( 'Table'[Version] ),
        ALLEXCEPT( 'Table', 'Table'[Project ID] )
    )
RETURN
    CALCULATE( SUM( 'Table'[Sales] ), FILTER( 'Table', [Version] = _version ) )

drag these fields in the table visual but replace the Sale with above measure.

And the result:

vchenwuzmsft_0-1636010958901.png

I put my pbix file in the attachment you can refer.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

amitchandak
Super User
Super User

@Enric21 , Try a measure like

measure =

var _1 = maxx(allselected(Table), Table[project Id] = max(Table[project Id])) ,[Version])

return

calculate(sum(Table[sales]), filter(Table, Table[Project ID] =_max))

 

Hi, 

 

I tried to do this measure but it didn't work for me, I got an error in [Version]): var _1 = maxx(allselected(Table), Table[project Id] = max(Table[project Id])) ,[Version])

 

I manage to solve my question in Power Query with the @v-jingzhang help. Thank you all I am very grateful recieving your support.

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.