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

Running total for records in table

Hi all, 

 

I am trying to create a historical trendline showing the past status of a KPI in a table but struggle to do so

 

Below is the example table used  

Table_1

Order NumberStatusDate ApprovedDate ClosedCondition ACondition B
1Open 1-Nov-17 NoNo
2Closed2-Feb-181-Jan-19NoNo
3Open 3-Mar-18 YesNo
4Open 4-Apr-19 NoNo
5Closed10-Apr-192-Feb-20NoNo

 

Using the table as an example, let's define the open record KPI for that reporting month as KPI-01

 

I am able to calculate the KPI record for the current month by creating this measure:

 

KPI-01 =

Calculate ( DistinctCountNoblank[OrderNumber], Filter(Table_1, Table_1[Condition A]= "No" && Table_1[Condition B]= "No], Table_1[Status] = "Open"]

 

Note : Condition A, B need to be "No" and Status need to be Open in order to qualify as a Count in KPI-01

 

However, I want to create a historical line chart where it shows the no. of KPI-01 based on the slicer date and not affected by the record status e.g.

  • If i sliced the date to May 18, it should show the historical KPI-01 value of 2 records 
  • If i sliced the date to Jan 20, it should show KPI-01 value as 3 records.
  • If i sliced the date till today, it should show KPI-01 value as 2 records

I have written the following running total dax only to realise that it is affected by the record status.

 

Total KPI-01 =
CALCULATE([KPI-01] ,
FILTER(
All(Table_1), Table_1[Date Approved ] <= MAX(Table_1[Date Approve])))

 

How can the running total DAX be written to reflect the historical record trend without being affected by the record status ?

 

Appreciate your help in this issue. Thanks !

 

3 REPLIES 3
wdx223_Daniel
Super User
Super User

@blackhawk  be careful of the function of DATEVALUE, it may not convert the text to datevalue you want.

wdx223_Daniel_0-1604368766981.png

 

amitchandak
Super User
Super User

Hi @amitchandak 

 

Thanks. Let me take a look to see if it can be adapted. 

 

 

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.

Top Solution Authors