cancel
Showing results for
Did you mean:
Helper II

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 1 20-09-2020 20 1 21-09-2020 10 1 23-09-2020 25 1 24-09-2020 25

In transit -

 BP_Depot expected date of reaching Quanity in shipment 1 20-09-2020 25 1 21-09-2020 0 1 22-09-2020 40 1 24-09-2020 15

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

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

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

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
Community Support

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.

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:

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.

4 REPLIES 4
Community Support

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

Super User IV

@powerbihelp1245 , 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])))

Proud to be a Super User!

Helper II

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

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.

Community Support

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.

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:

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.

Announcements

Happy New Year from Power BI

This is a must watch for a message from Power BI!