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
ChicagoPBI_noob
Frequent Visitor

Display 1 row of customer data from 2 different dates where dates are selected dynamically by user

I have a tricky one I need help solving.  I have 1 data table that archives customer information every day. Each customer has a unique identifier, however, due to the daily archiving, this identifier is only unique when concatenated with the date.  What I'm trying to do is display each customer on 1 row with information from 2 different dates.  The ask from the 'user' is to see how the customer migrated for a specific metric from date 1 to date 2.  So as an example, Customer A will be displayed on 1 row and the columns displayed will be: Customer Name, Date 1, Metric (as of date 1), Date 2, Metric (as of date 2).  Customer B will be displayed on the next row and so on...  Keep in mind, the Date 1 and Date 2 needs to be selectable by the users.  So a user should be able to open the report and select 2 different dates and the report will update and display the information as of the 2 dates selected by the user.  I have been able to do this in a different reporting tool, so I can explain how if that helps.

1 ACCEPTED SOLUTION

OK, I *think* what you want to do is to create 2 slicers and remove all of their cross-filtering to any other tables. Then, you can use SELECTEDVALUE for each slicer to construct a measure that reports back the rating change. This measure would simply filter your table based upon your first date and return the value. You would use a VAR for this. You would then use another VAR to filter your table by your other SELECTEDVALUE and get that rating. Then just RETURN the difference.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

10 REPLIES 10
v-jianhe-msft
Resolver II
Resolver II

Hi,

 

Please provide sample datasource/tables used, and the expected result you hope to get using screenshot. You could also share the report via OneDrive link.

 

Best Regards,

Henry 

 

Greg_Deckler
Super User
Super User

Please provide sample/example data and expected output. Lots of words in there.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for your suggestion.  I have put together an excel file with 2 tabs.  The 1st tab is a representation of the raw data being linked/referenced in the report.  The 2nd tab is the desired output.  However, I'm unsure how to attach it here.  Please advise.

Thanks,

Depending on how much data, and you generally do not need a lot of it, you could just copy the data from Excel and paste it. Otherwise, upload the Excel file to a cloud-based repository like OneDrive or Box and create a link for it and then paste that link here.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Desired Output would look something like this:

 

 

Customer_IDCustomer_NameDate_1Customer_Rating_1Date_2Customer_Rating_2Rating_Change
A123456789AAA_Corp4/30/201715/31/20172-1
B123456789BBB_Corp4/30/201745/31/20175-1
C123456789CCC_Corp4/30/201715/31/20172-1
D123456789DDD_Corp4/30/201745/31/20175-1

The user will select 2 dates, obviously based on my output data, I selected date_1 = 4/30/2017 & date_2 = 5/31/2017

OK, I *think* what you want to do is to create 2 slicers and remove all of their cross-filtering to any other tables. Then, you can use SELECTEDVALUE for each slicer to construct a measure that reports back the rating change. This measure would simply filter your table based upon your first date and return the value. You would use a VAR for this. You would then use another VAR to filter your table by your other SELECTEDVALUE and get that rating. Then just RETURN the difference.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for your response. Your solution worked.  However, I had another power user actually do the work since it was above my head.  Here's the formula we used:

DDifference =
    VAR date_1 = SELECTEDVALUE(qry_Monthly_FAC_AllDates[Date])
    VAR date_2 = SELECTEDVALUE('qry_Monthly_FAC_AllDates (2)'[Date])
    RETURN
    (CALCULATE(MAX(qry_Monthly_FAC_AllDates[Final Risk Rating]), FILTER(qry_Monthly_FAC_AllDates, qry_Monthly_FAC_AllDates[Date] = date_1)) - CALCULATE(MAX('qry_Monthly_FAC_AllDates (2)'[Final Risk Rating]), FILTER('qry_Monthly_FAC_AllDates (2)', 'qry_Monthly_FAC_AllDates (2)'[Date] = date_2)))

In the desired output, there will also need to be 2 date selectors for the users to select the 2 dates they want to see.

Raw Data Sample:

Customer_IDCustomer_NameDateCustomer_Rating
A123456789AAA_Corp1/31/20171
A123456789AAA_Corp2/28/20171
A123456789AAA_Corp3/31/20171
A123456789AAA_Corp4/30/20171
A123456789AAA_Corp5/31/20172
A123456789AAA_Corp6/30/20172
A123456789AAA_Corp7/31/20171
A123456789AAA_Corp8/31/20171
A123456789AAA_Corp9/30/20172
A123456789AAA_Corp10/31/20173
A123456789AAA_Corp11/30/20173
A123456789AAA_Corp12/31/20174
B123456789BBB_Corp1/31/20172
B123456789BBB_Corp2/28/20172
B123456789BBB_Corp3/31/20174
B123456789BBB_Corp4/30/20174
B123456789BBB_Corp5/31/20175
B123456789BBB_Corp6/30/20172
B123456789BBB_Corp7/31/20173
B123456789BBB_Corp8/31/20171
B123456789BBB_Corp9/30/20174
B123456789BBB_Corp10/31/20175
B123456789BBB_Corp11/30/20175
B123456789BBB_Corp12/31/20174
C123456789CCC_Corp1/31/20172
C123456789CCC_Corp2/28/20174
C123456789CCC_Corp3/31/20175
C123456789CCC_Corp4/30/20171
C123456789CCC_Corp5/31/20172
C123456789CCC_Corp6/30/20171
C123456789CCC_Corp7/31/20172
C123456789CCC_Corp8/31/20173
C123456789CCC_Corp9/30/20174
C123456789CCC_Corp10/31/20175
C123456789CCC_Corp11/30/20172
C123456789CCC_Corp12/31/20171
D123456789DDD_Corp1/31/20175
D123456789DDD_Corp2/28/20175
D123456789DDD_Corp3/31/20174
D123456789DDD_Corp4/30/20174
D123456789DDD_Corp5/31/20175
D123456789DDD_Corp6/30/20175
D123456789DDD_Corp7/31/20174
D123456789DDD_Corp8/31/20174
D123456789DDD_Corp9/30/20173
D123456789DDD_Corp10/31/20174
D123456789DDD_Corp11/30/20174
D123456789DDD_Corp12/31/20173

 

 

 

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.