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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
nssidhu74
Frequent Visitor

Create a Table with Column including MAX Date and group by country

How do a translate the following Query. I want to create new table like the one in the following Query.

(NOTE: Updated the Query from the Incorrectone)

Select Distinct(SourceCountry), 
  ( Select MAX(Data_date) from FactInventory FI Where FI.SourceCountry = I.SourceCountry) AS MaxDate,
 ( Select Sum(Volume) from FactInventory FI Where FI.SourceCountry = I.SourceCountry and FI.Data_Date = ( Select MAX(Data_date) from FactInventory FII Where FII.SourceCountry = I.SourceCountry) ) AS SumVolume
       From FactInventory I
 
2 ACCEPTED SOLUTIONS
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @nssidhu74 ,

 

look at this.

https://docs.microsoft.com/en-us/dax/summarize-function-dax

If I answer you question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

Hi @nssidhu74 ,

 

As what you have requested, you need to create a new table as below:

 

 

NEW table = SUMMARIZE('FactSales','FactSales'[SourceCountry],'FactSales'[Data_Date],"Data_Date DESC",MAX('FactSales'[Data_Date]),"VOLUME",SUM('FactSales'[VOLUME]))

 

 

Then in the new table, turn to the column  you wanna sort by  and click on the drop-down button, choosing “sort descending” ,finally you will see as below:

1111.png222.png

 

For the related .pbix file, you can turn to the URL: https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-kellya_microsoft_com/EWwtQnkFjdhIvflUHyW-zk8...

 

Hope this would help.

 

Best Regards,

Kelly

View solution in original post

5 REPLIES 5
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @nssidhu74 ,

 

has your question been answered?

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


mwegener
Most Valuable Professional
Most Valuable Professional

Hi @nssidhu74 ,

 

load the FactSales table into Power BI.

Choose the table visual, put the columns into the Values field.

Set the aggregation for the column Data_Date to Lastest and sort the table visual by the Data_Date column.

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


I want to Create New Table, I want to get the Selected Value like SourceCountry and Date Field using SelectedValues formula.

So essentially looking for something like 
NEWTable = DAX Expression(.....................)

Hi @nssidhu74 ,

 

As what you have requested, you need to create a new table as below:

 

 

NEW table = SUMMARIZE('FactSales','FactSales'[SourceCountry],'FactSales'[Data_Date],"Data_Date DESC",MAX('FactSales'[Data_Date]),"VOLUME",SUM('FactSales'[VOLUME]))

 

 

Then in the new table, turn to the column  you wanna sort by  and click on the drop-down button, choosing “sort descending” ,finally you will see as below:

1111.png222.png

 

For the related .pbix file, you can turn to the URL: https://microsoftapc-my.sharepoint.com/:u:/g/personal/v-kellya_microsoft_com/EWwtQnkFjdhIvflUHyW-zk8...

 

Hope this would help.

 

Best Regards,

Kelly

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @nssidhu74 ,

 

look at this.

https://docs.microsoft.com/en-us/dax/summarize-function-dax

If I answer you question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.