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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

show data on two dates in one table

hi experts,

 

I have a dataset like below,

DateProductIdCategoryAmount
10/31/2019101A10
10/31/2019102A12
10/31/2019103B110
12/31/2019101A15
12/31/2019102A14
12/31/2019104C20
4/30/2020101A15
4/30/2020102B110
4/30/2020105B50
............

Basically, on different dates, we have some products, and each product is categorized into groups, however the categorization can change from date to date. For example in above table, product 102 was in Group A on 10/31/2019, but in Group B on 4/30/2020

Now I want to create a dashboard, in this dashboard, I need two filters on date, Date1 and Date2, so users can choose two dates to compare. For example, I can choose 4/30/2020 in Date1 filter and choose 10/31/2019 in Date2 filter, then I want to show data in a table in below format:

ProductIdDate1 CategoryDate1 AmountDate2 CategoryDate2 Amount
101A10A15

102

A12B110
103B110  
105  B50

 

How can I achieve this?

 

Thanks,

Michael

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

Hi @Anonymous ,

 

You will need to create two slicer tables and four measures.

slicer1 = DISTINCT('Table'[Date])

slicer2 = DISTINCT('Table'[Date])
Date1 Category = CALCULATE(SELECTEDVALUE('Table'[Category]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer1[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Date1 Amount = CALCULATE(SELECTEDVALUE('Table'[Amount]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer1[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Date2 Category = CALCULATE(SELECTEDVALUE('Table'[Category]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer2[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Date2 Amount = CALCULATE(SELECTEDVALUE('Table'[Amount]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer2[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Use the date column from these two slicer tables and the result would be shown as below.

1.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

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

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

View solution in original post

5 REPLIES 5
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You will need to create two slicer tables and four measures.

slicer1 = DISTINCT('Table'[Date])

slicer2 = DISTINCT('Table'[Date])
Date1 Category = CALCULATE(SELECTEDVALUE('Table'[Category]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer1[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Date1 Amount = CALCULATE(SELECTEDVALUE('Table'[Amount]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer1[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Date2 Category = CALCULATE(SELECTEDVALUE('Table'[Category]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer2[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Date2 Amount = CALCULATE(SELECTEDVALUE('Table'[Amount]),FILTER(ALLSELECTED('Table'),'Table'[Date]=SELECTEDVALUE(slicer2[Date])&&'Table'[ProductId]=SELECTEDVALUE('Table'[ProductId])))

Use the date column from these two slicer tables and the result would be shown as below.

1.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
vanessafvg
Super User
Super User

will there only ever be 2 categories?   

can group A happen and then group A again?

what is the rule for the sequence, what is the pattern?   is it a = 1, b  = 2, if so your data isn't showing that.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Hi,

 

Thanks for your reply.

There will be many categories, and the total number of categories are unknown, we can always have new categories too. 

A product can be categorized into Group A on day 1, and categorized to Group B on day 2, and categorized back to Group A on day 3, and so on. 

There's no pattern on how product is categorized. We just treat the category as an attribute of products.

 

Thanks,

Michael

so the sequence / pattern is then the date, date 1 = 1 , date 2 = 2 so it needs to be ordered by date and it can have a variable amount of dates?




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

hi vanessafvg,

 

yes there can be variable amount of dates, right now we have one year dates.

 

thanks,

Michael

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.