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
aJ2
Helper I
Helper I

Using comparison operators with 'Date' data type

Hi.

 

I have created two measures for a common purpose ie i want to calculate the conversions before July 2018 from one table A and from July 2018 from another table B. When I want to split it between different months, it creates an aggregate rather than just for the particular month.

 

The formula for table A:- conversions_old = CALCULATE(SUM(tableA[conversions]), "MONTH('date'[date_key])<7, YEAR('date'[date_key])<=2018)

 

The formula for table B:- conversions_new = CALCULATE(DISTINCTCOUNT(tableB[conversions]), all_txns[platform]="app", all_txns[order_id]<282349, MONTH('date'[date_key])>6, YEAR('date'[date_key])>=2018)

 

The combined measure is conversions_all = conversions_new + conversions_old.

 

So when I split the same by year_month, it gives an aggregated value rather than splitting it by month.

 

Kindly help me resolve this issue.

 

 

1 ACCEPTED SOLUTION

Hi @rajulshah

 

I was able to filter according to the dates by using the FILTER() function.

 

The formulas are- 

 

conversions app new = CALCULATE(SUM(tableA[conversions]), FILTER('date', FORMAT('date'[date_key], "yyyy-mm") > "2018-06"))

 

conversions app new = CALCULATE(SUM(tableB[conversions]), FILTER('date', FORMAT('date'[date_key], "yyyy-mm") < "2018-07"))

 

 

Thank you for your assisstance.

 

View solution in original post

3 REPLIES 3
rajulshah
Resident Rockstar
Resident Rockstar

Hello @aJ2,

 

Can you please share your current data vs your expected data?

Hi @rajulshah

 

I was able to filter according to the dates by using the FILTER() function.

 

The formulas are- 

 

conversions app new = CALCULATE(SUM(tableA[conversions]), FILTER('date', FORMAT('date'[date_key], "yyyy-mm") > "2018-06"))

 

conversions app new = CALCULATE(SUM(tableB[conversions]), FILTER('date', FORMAT('date'[date_key], "yyyy-mm") < "2018-07"))

 

 

Thank you for your assisstance.

 

Hi @aJ2,

 

Have you solved your problem?

 

If you have solved, please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.)

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.