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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply

Get specific data from a group (dax)

HI,

i have this problem, i got the sales on Jan2018 and a comparative one (May 2018), how can i get just the sales that are in the first group period but no in the second and sales that are lower in the second period compared to the first.

 

Thanks.

 

 

DAX.PNG

1 ACCEPTED SOLUTION
edhans
Super User
Super User

This is really better done in Power Query, but you specified DAX. The DAX calculated column would be:

 

Column = 
IF(
    ISBLANK('Sales Data'[May 2018]),
    'Sales Data'[Jan 2018],
    IF('Sales Data'[May 2018] < 'Sales Data'[Jan 2018],
        'Sales Data'[Jan 2018],
        BLANK()
    )
)

Then add a Grid visual, add the "Items" (A, B, C...) field and the new "Columns" (Call it whatever you want) column and it will automatically show your results. It will not show rows where "Columns" is blank.

image.png

 

If you'd rather see this in Power Query, ping back. PQ is better at data modeling than DAX is. In this limited case, the logic will be similar, and the data set is small, but if this were a few thousand records, DAX starts to get large and potentially slower with lots of data in calculated columns.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

This is really better done in Power Query, but you specified DAX. The DAX calculated column would be:

 

Column = 
IF(
    ISBLANK('Sales Data'[May 2018]),
    'Sales Data'[Jan 2018],
    IF('Sales Data'[May 2018] < 'Sales Data'[Jan 2018],
        'Sales Data'[Jan 2018],
        BLANK()
    )
)

Then add a Grid visual, add the "Items" (A, B, C...) field and the new "Columns" (Call it whatever you want) column and it will automatically show your results. It will not show rows where "Columns" is blank.

image.png

 

If you'd rather see this in Power Query, ping back. PQ is better at data modeling than DAX is. In this limited case, the logic will be similar, and the data set is small, but if this were a few thousand records, DAX starts to get large and potentially slower with lots of data in calculated columns.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thanks

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors