Forum Discussion
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.
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.
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.
2 Replies
- edhansCommunity Champion
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.
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.
- carloscabreraqHelper I
Thanks