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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

DAX Subtract Pivot Table Columns Measure

Hello,

I am relatively new to DAX and I am stuck at one point where I am trying to calculate the difference between two dates.

For example, the current setup of the table looks like this:

 

The 1 that we can is coming from a measure that I have created

CALCULATE([Total_Red_count],FILTER('Coles Data','Coles Data'[FW_END_DATE_MAX]=FIRSTNONBLANK('Coles Data'[FiscalWeekEndDate],'Coles Data'[FiscalWeekEndDate])))
return result

Now, the next step that I can't seem to figure out is how should I subtract those columns within DAX. For instance, how should I go about subtracting 2/08/2020 from 28/06/2020. The answer should be 0. I need to do this across the entire table and then aggregate this by -1 and 1. -1 means the product was removed and 1 would be that the product was added. Happy to post more examples if you require.

 

Can anyone please assist with this?

 

Thank you

Screenshot_1.png

1 REPLY 1
Anonymous
Not applicable

@Anonymous 

I don't see logic behind that how can you get an integer like 0, 1 when subtracting two dates. Normally it returns how many days.

 

I guess you mean subtracting the [Total_Red_count] between the two dates? In this case, can you also show the dax for [Total_Red_count].

 

Paul Zheng _ Community Support Team

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.