cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper V

## Calculate previous Day together

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.

2 ACCEPTED SOLUTIONS
Super User

@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))

Community Support

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

2 REPLIES 2
Community Support

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

Super User

@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))

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

#### Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors