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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Rohitr33f
New Member

Display date using DAX

Hi,

I am trying to display the date only using DAX for below query. Can anyone help on this?

 

select

top 1 creation_date

FROM [ViewStore].[dbo].[ViewTableHFile_Last2Years]

group by creation_date

order by count(filename) desc

 

Regards

Rohit Rawat

2 REPLIES 2
SpartaBI
Community Champion
Community Champion

@Rohitr33f try this measure:

 

Measure = 
VAR _tbl = 
    ADDCOLUMNS(
        VALUES(ViewTableHFile_Last2Years[creation_date]),
        "@Count", CALCULATE(COUNTROWS(ViewTableHFile_Last2Years))
    )
VAR _max_count = MAXX(_tbl,[@Count])
VAR _filterd_tbl = 
    FILTER(
        _tbl,
        [@Count] = _max_count
    )
VAR _result = 
    CONCATENATEX(_filterd_tbl, ViewTableHFile_Last2Years[creation_date], ", ", ViewTableHFile_Last2Years[creation_date], ASC)
RETURN
    _result

 


This is a link to a sample file I did for this question (ignore the other tables there):
Display date using DAX.pbix



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

Thanks for your help SpartBI. 

This solution helped me learn new things but did not give the exact solution as I need. Here i could not see anywhere filename has been considered.

I am trying to achieve the Date when the higher count of files were created in the past and also sperate date for a current year.

If you could any sggestion again then please advice.

Thanks for the help I really appreciate it.

Sample data and I am expecting 2/8/2019 date for all the past years and 6/8/2020 for current (lets say 2020 is current year) seprately :

 

creation_date          filenamefilename count
   
2/8/2019190208_Y7QYGY_v1.Bdbadm.xlsx44
6/8/2020200608_37F4FX.Alif.docx13
6/8/2020200608_37F4FX.Blif.docx12
6/8/2020200608_37F6GX.Alif.pdf1
6/8/2020200608_37F6GX.Blif.pdf1
8/20/2020200820_3LYSTC_v2_0.Cphilibs.pdf1
9/28/2020200928_2EW3SN_v2.Adbadm.pdf1
9/28/2020200928_2EW3SN_v2.Bdbadm.pdf1

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.