Forum Discussion

nssidhu74's avatar
nssidhu74
Frequent Visitor
6 years ago
Solved

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
 

5 Replies

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost 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.

    • nssidhu74's avatar
      nssidhu74
      Frequent Visitor

      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(.....................)

  • mwegener's avatar
    mwegener
    Icon for Most Valuable Professional rankMost 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.