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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

power bi dax Min date of each category

Hi Community,

I am familiar with SQL and I can write a query to return results of a query to Select MIN(Date), MAX(Date), SUM(quality) and GROUP BY. However, I am new to Power BI and DAX and find it difficult to do the same on Power BI. Below is my situation.

These tables on Power BI:

Dim_ManefactureDate

 

peternznguyen_7-1656494237354.png

 

 

Dim_ReleaseDate

 

peternznguyen_8-1656494270405.png

 

Fact_OrderID

 

peternznguyen_9-1656494304580.png

 

 

Table Relationships 

 

peternznguyen_10-1656494317460.png

 

 

Adding a table visualization to a new page to show data from three tables above, data is showing as below: 

 

peternznguyen_11-1656494374112.png

 

 

Under Values of Visualizations, when selecting SUM over Netweight, it automatically summarizes expected Netweight. However, for ManufactureDate and ReleaseDate, when selecting Earliest then Power BI table shows unexpected 1/01/1900 values like this:

 

peternznguyen_12-1656494429003.png

 

I expect earliest date of each OrderID as below:

 

peternznguyen_13-1656494460348.png

 

I have also tried to use a DAX function to create a new column but it gets error

ManufactureDate_Earliest = 
    VAR Sum_Netweight = SUM(Fact_OrderID[NetWeight])
    VAR GroupBy_OrderID = GROUPBY(Fact_OrderID,Fact_OrderID[OrderID])
    RETURN
        CALCULATE(
             MIN(RELATED(Dim_ManufactureDate[DateBK]))
            )

Thank you very much for your help

Peter

2 ACCEPTED SOLUTIONS
SpartaBI
Community Champion
Community Champion

@Anonymous there are few ways to approach it, but becasue you are very new, so let's try this. Why didn't you just put the date columns from the fact instead of the dim?

View solution in original post

@Anonymous  the measures will look like:

Earliest_CompletionDate = 
CALCULATE(
    MIN(CompletionDate[DateBK]),
    CROSSFILTER(Fact_ShippingKPI[CompletionDate_DateSK], CompletionDate[DateSK], BOTH)
)






2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

View solution in original post

4 REPLIES 4
SpartaBI
Community Champion
Community Champion

@Anonymous there are few ways to approach it, but becasue you are very new, so let's try this. Why didn't you just put the date columns from the fact instead of the dim?

Anonymous
Not applicable

@SpartaBI , thank you for your reply. Dim_ManufactureDate and Dim_ReleaseDate were from Dim_Date that contains many other columns such as DayOfMonthCode, DayOfWeekCode, FullDateDesicription, MonthOfYearDescription, etc., so that's why I don't put everything in the Fact table. I have tried using Matrix but I don't expect the result from Matrix.

@Anonymous ok, will PM you now

@Anonymous  the measures will look like:

Earliest_CompletionDate = 
CALCULATE(
    MIN(CompletionDate[DateBK]),
    CROSSFILTER(Fact_ShippingKPI[CompletionDate_DateSK], CompletionDate[DateSK], BOTH)
)






2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.