cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
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
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

Accepted Solutions
Highlighted

Hi @powerbihelp1245 

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
Highlighted
Super User IV
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])))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted

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

Highlighted

Hi @powerbihelp1245 

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

Highlighted
Community Support
Community Support

Hi @powerbihelp1245 

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors