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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jnrezk
Helper III
Helper III

2 measures in one by date

Hi! 

I have 2 measures - one for data before Dec 17 2021 and one for after. We made a change this date so is there away to combine it to one measure so the chart so it's one line before & after the change?

 

So if I make 2 measures, one called "Pre Dec 17" and one called "Post Dec 17" - how can I show them in one measure called "Combined View" dependent on those dates. 

 

I would think it would be something like

Combined View =

If date is before Dec 17, then use "Pre Dec 17" and if post Dec 17 then use "Post Dec 17"

 

I hope this makes sense!


Jackie

 

 

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @jnrezk ,

 

How many data table do you have?

Here are two scenarios:

1. You have two data tables, one for measure before 2021/12/17, another one for measure after 2021/12/17.

2. You have only one data table, it contains all values and you create two measures based on it.

Here I suggest you to create a calendar table with continuous dates by dax. Then relate it with your data table by Date columns. Then create a measure and build a visual by Date column from calendar table.

I think the odds are that you are in situation 1.

1.png

Measure = 
IF(MAX('Date'[Date])< DATE(2021,12,17),[Before 2021/12/17],[After 2021/12/17])

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-rzhou-msft
Community Support
Community Support

Hi @jnrezk ,

 

How many data table do you have?

Here are two scenarios:

1. You have two data tables, one for measure before 2021/12/17, another one for measure after 2021/12/17.

2. You have only one data table, it contains all values and you create two measures based on it.

Here I suggest you to create a calendar table with continuous dates by dax. Then relate it with your data table by Date columns. Then create a measure and build a visual by Date column from calendar table.

I think the odds are that you are in situation 1.

1.png

Measure = 
IF(MAX('Date'[Date])< DATE(2021,12,17),[Before 2021/12/17],[After 2021/12/17])

Result is as below.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thanks so much! will give it a try

amitchandak
Super User
Super User

@jnrezk , simply add them and try 

 

measure 3 =[measure1] +[Measure2]

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak no, i need the logic for the date before and after x date so that the Pre measure doesn't have any data after Dec 17 and the post doesnt pull any data before Dec 17

@jnrezk , comments show option. But if you want to select a date from slicer and what work across all date. Better to use independent date table and measure like

 

Measure 1=
var _max = maxx(allselected('Date'), 'Date'[Date]) // Or // date(2021,12,17) //Or Today()
return
calculate(sum(Table[value]), filter('Table', 'Table'[Date] > _max))


Measure 2=
var _max = maxx(allselected('Date'), 'Date'[Date]) // Or // date(2021,12,17) //Or Today()
return
calculate(sum(Table[value]), filter('Table', 'Table'[Date] > _max))

 

or with joined date tbale

 

 

Measure 1=
var _max = maxx(allselected('Date'), 'Date'[Date]) // Or // date(2021,12,17) //Or Today()
return
calculate(sum(Table[value]), filter(all('Date'), 'Date'[Date] > _max))


Measure 2=
var _max = maxx(allselected('Date'), 'Date'[Date]) // Or // date(2021,12,17) //Or Today()
return
calculate(sum(Table[value]), filter(all('Date'), 'Date'[Date] > _max))

 

 

The second option can not give trend 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

I have to be honest you always answer my posts but I never understand haha

 

@jnrezk , Share some sample data and expected output. One More Try

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.