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

Measure not showing value for all dates in table visual

I am calculating a measure for getting the cumulative total of a column before a date but it only shows the total for some dates, although that total is correct for all the dates the total is showing up. 

To explain -  

The data tables I have is - 
PRE DR - 

BP-depot Order valid till Date loss quantity
120-09-202020
121-09-202010
123-09-202025
124-09-202025

 

In transit - 

BP_Depotexpected date of reachingQuanity in shipment
120-09-202025
121-09-20200
122-09-202040
124-09-202015

 

The BP_Depot column can be thought of as the key column - 

I have made a date table and done the following relationships - 

 

powerbihelp1245_0-1600940983681.png

 

@amitchandak I had missed adding the above image, hope it will help in solving

 

 

In Transit Running Total = 
VAR LastVisibleDate =
    SELECTEDVALUE(dates[Date])
VAR FirstVisibleDate =
    MIN ( transit[expected date of reaching] )
VAR LastDateWithorder =
    CALCULATE (
        MAX ( PreDR[Order valid till Date] ),
        REMOVEFILTERS ()   
    )
VAR Result =
    IF (
        FirstVisibleDate<= LastDateWithorder,
        CALCULATE (
            SUM(transit[Quanity in shipment]),
            transit[expected date of reaching] <= LastVisibleDate 
        )
    )
RETURN
    Result

 

 

 

 

 

My resultant table visual looks like this - 
image.png

 
For the date 22-09-20 also it should show 65 as if you see the transit table 40 quanity is reaching on 22nd.

 

I need this because I am doing some other measure calculations based on this measure which requires a value for this date for this cumulative total measure.

1 ACCEPTED SOLUTION

Hi @Anonymous 

The reason caused your problem may be that there isn't any relationship between Date Table and transit table. 

I think you can change your relationship as below.

1.png

And build a measure:

 

In Transit Running Total = 
SUMX(FILTER(ALL(transit),transit[expected date of reaching]<=MAX('Date'[Date])),transit[Quanity in shipment])

 

Result:

2.png

Or you can keep (both direction)relationships between PreDR,Key and transit, and remove relaionships between Data Table with them. Build loss quantity by measure, and In Transit Running Total Measure will show correctly as well.

 

Best Regards,

Rico Zhou

 

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

 

 

 

View solution in original post

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

amitchandak
Super User
Super User

@Anonymous , with cumulative, with date table, try a formula like. Join both dates with date table and try like example

 

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

or

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=maxx(date,date[date])))

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all(date),date[date] <=maxx(date,date[date])))

Anonymous
Not applicable

@amitchandak  See the following results I get with your 3 measures - 

image.png

 
code for these measures as suggested by you - 

total in transit 1 = CALCULATE(SUM(transit[Quanity in shipment]),filter(dates,dates[Date] <=maxx(dates,dates[Date])))

 

total in transit 2 = CALCULATE(SUM(transit[Quanity in shipment]),filter(ALLSELECTED(dates),dates[Date] <=maxx(dates,dates[Date])))
total in transit 3 = CALCULATE(SUM(transit[Quanity in shipment]),filter(ALL(dates),dates[Date] <=maxx(dates,dates[Date])))


The values still don't show for 22nd, the cumulative total is wrong as well. 

Hi @Anonymous 

The reason caused your problem may be that there isn't any relationship between Date Table and transit table. 

I think you can change your relationship as below.

1.png

And build a measure:

 

In Transit Running Total = 
SUMX(FILTER(ALL(transit),transit[expected date of reaching]<=MAX('Date'[Date])),transit[Quanity in shipment])

 

Result:

2.png

Or you can keep (both direction)relationships between PreDR,Key and transit, and remove relaionships between Data Table with them. Build loss quantity by measure, and In Transit Running Total Measure will show correctly as well.

 

Best Regards,

Rico Zhou

 

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

 

 

 

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.