The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello everyone,
I have a matrix with year, month and day. I would now like to see another subtotal displayed.
If possible, the intermediate result should be displayed above each day.
I've tried everything, I can't get any further.
Here is the measure used:
kaufende POS = COUNTROWS('Customers')
Here is how I imagine it:
Subtotal | 30 | |
3 Mai 2024 | 24 | |
Subtotal | 12 | |
2 Mai 2024 | 12 |
Here's the explanation as to why the subtotal is 30 after May 3rd: Because I only want to show one-time customers and not customers who have already purchased before. In other words, there are customers here who bought on May 2nd and also on May 3rd. Duplicates should not be counted twice.
If the rows are too complicated, I'm also happy with a new column. Just like the lines, this should add up the customers from the previous day and only calculate duplicates once.
If it's not possible, I would like to have the result as a column.
Thank you for any help.
Solved! Go to Solution.
@azaterol , if you are currently using one measure in matrix visual. You can use 2 and use option Switch values on rows.
the second measure can be a distinct count for the last 2 days. Prefer date table, joined with the date of your table
Rolling 2 = CALCULATE(distinctcount('Customers'[ID]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-2,day))
Hi @amitchandak ,thanks for the quick reply, I'll add more.
Hi @azaterol ,
The Table data is shown below:
Use the following DAX expression to create a measure
Measure2 =
VAR _currentDate =
SELECTEDVALUE ( 'Table'[Date] )
VAR _previousDate = _currentDate - 1
RETURN
CALCULATE (
COUNTROWS ( DISTINCT ( 'Table'[Member ID] ) ),
ALL ( 'Table'[Date] ),
'Table'[Date] >= _previousDate
&& 'Table'[Date] <= _currentDate
)
Final output
Best Regards,
Wenbin Zhou
Hi @amitchandak ,thanks for the quick reply, I'll add more.
Hi @azaterol ,
The Table data is shown below:
Use the following DAX expression to create a measure
Measure2 =
VAR _currentDate =
SELECTEDVALUE ( 'Table'[Date] )
VAR _previousDate = _currentDate - 1
RETURN
CALCULATE (
COUNTROWS ( DISTINCT ( 'Table'[Member ID] ) ),
ALL ( 'Table'[Date] ),
'Table'[Date] >= _previousDate
&& 'Table'[Date] <= _currentDate
)
Final output
Best Regards,
Wenbin Zhou
@azaterol , if you are currently using one measure in matrix visual. You can use 2 and use option Switch values on rows.
the second measure can be a distinct count for the last 2 days. Prefer date table, joined with the date of your table
Rolling 2 = CALCULATE(distinctcount('Customers'[ID]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-2,day))
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
82 | |
77 | |
47 | |
39 |
User | Count |
---|---|
150 | |
116 | |
68 | |
64 | |
57 |