Hello all,
i have the below measure:
Type | Amount | Date |
Balance | $162 | 6/30/2022 |
Balance | $569 | 6/30/2022 |
Balance | $98 | 6/30/2022 |
Balance | $569 | 6/30/2022 |
Balance | $98 | 6/30/2022 |
Balance | $50,913 | 6/30/2022 |
Balance | $3,321 | 6/30/2022 |
Balance | $9,803 | 6/30/2022 |
$65,533 |
|
Hi @CJKPowerBI ,
Has your problem been solved? If solved, please consider Accept it as the solution to help the other members find it more quickly.
Best regards,
Yadong Fang
Hi,
Create a Calendar Table with a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table. Write these measures
Bal = SUM('Table'[Amount])
Farthest date = max('Table'[Date])
Bal latest = calculate([Bal],datesbetween(calendar[date],[Farthest date],[Farthest date]),'Table'[Type]="Balance")
Hope this helps.
@CJKPowerBI Try:
Measure =
VAR __Max_Date = MAX('Table'[Date])
VAR __Table = FILTER(ALLSELECTED('Table'),[Date] = __Max_Date && [Type] = "Balance")
RETURN
SUMX(__Table, [Amount])
@CJKPowerBI It is quite likely that you are unintentionally withholding critical information. Please see the PBIX attached below signature. You want Table 4 and Measure 4 in that table. Works.
@Greg_Deckler thank you for sending the .pbix but still didnt work with my data... indeed i have more columns which are not in the measure but maybe they create the issue...
my data is in an excel and as below if i have no filters at all so based on the measure it should show the sum of all column Amount correct?
Type | Owner | Inv. Type | Institution | Amount | Date |
Balance | Owner1 | Cash | 1 | $89,485 | 6/30/2021 |
Balance | Owner1 | Cash | 1 | $7,171 | 6/30/2021 |
Balance | Owner1 | Cash | 1 | $376 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $1,989 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $473 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $1,989 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $473 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $118,020 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $11,607 | 12/31/2021 |
Balance | Owner1 | Cash | 1 | $162 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $569 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $98 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $569 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $98 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $50,913 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $3,321 | 6/30/2022 |
Balance | Owner2 | Cash | 1 | $9,803 | 6/30/2022 |
@CJKPowerBI Here is an updated PBIX (below signature) with an your new sample data. As you ucan see in the Card visual you get the correct value $65,533. I also added a Measure 5 so that you can see exactly which rows are being included in that calculation (not all rows, just rows with the most recent date as you originally specified. Is the problem that you aren't getting the $65,533 number in some other visualization that you have? Perhaps this version will work for you although I would really need to know the visualization being used and its configuration:
Measure 6 =
VAR __Max_Date = MAXX(ALL('Table4'),[Date])
VAR __Table = FILTER(ALL('Table4'),[Date] = __Max_Date && [Type] = "Balance")
RETURN
SUMX(__Table, [Amount])
You can see how the two measures work differently in the Table visual.
Finally, just from your description, I wonder if perhaps you are running afoul of AutoExist where you are filtering on two or more columns in the same table and autoexist is removing all of the rows it doesn't think should be calculated.