Forum Discussion
ARWCL
1 year agoRegular Visitor
DAX syntax error for ...
i have asked Power Bi to create a DAX function to show me an individuals wealth based on slicers for individual, and month end dates but when i have copied this in to Power BI Desktop I keep getting ...
- Anonymous1 year ago
Hi ARWCL
Based on your data and the final goal, i create the following measures.
Note:there are no relationships among tables.
MEASURE = VAR filterdate = IF ( ISFILTERED ( DateTable[Date] ), MAX ( DateTable[Date] ), MAXX ( ALLSELECTED ( 'Value'[Date] ), [Date] ) ) VAR filterassetid = CALCULATETABLE ( VALUES ( 'FamilyMembers'[AssetID] ), FamilyMembers[OwnershipStartDate] <= filterdate, OR ( FamilyMembers[OwnerShipEndDate] >= filterdate, ISBLANK ( FamilyMembers[OwnerShipEndDate] ) ) ) VAR maxdate = MAXX ( FILTER ( ALLSELECTED ( 'Value' ), [AssetID] IN filterassetid && [AssetID] IN VALUES ( 'Value'[AssetID] ) && [Date] <= filterdate ), [Date] ) VAR maxvalue = MAXX ( FILTER ( ALLSELECTED ( 'Value' ), [Date] = maxdate && [AssetID] IN VALUES ( 'Value'[AssetID] ) && [AssetID] IN filterassetid ), [Value] ) VAR subvalue = SUMX ( FILTER ( ALLSELECTED ( 'Value' ), [ParentAssetID] IN VALUES ( 'Value'[AssetID] ) && [ParentAssetID] IN filterassetid && [Date] <= filterdate ), [Value] ) VAR ownerper = MAXX ( FILTER ( ALLSELECTED ( FamilyMembers ), [AssetID] IN VALUES ( FamilyMembers[AssetID] ) && [AssetID] IN VALUES ( 'Value'[AssetID] ) && [AssetID] IN filterassetid ), [OwnershipPercentage] ) RETURN ( maxvalue + subvalue * ownerper ) * ownerperMeasure2 = VAR a = ADDCOLUMNS ( SUMMARIZE ( ALLSELECTED ( 'Value' ), [AssetID] ), "Measure", [Measure] ) RETURN SUMX ( FILTER ( a, [AssetID] IN VALUES ( 'Value'[AssetID] ) ), [Measure] )Then put the measure2 to the card.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
parry2k
1 year agoSuper User
ARWCL very hard to tell from DAX expressions. It will be easier if you share pbix file using one drive/google drive with the expected output. Remove any sensitive information before sharing.
- ARWCL1 year agoRegular Visitor
See below images of the test tables and Power BI report i have tried to create. Should be really easy to replicate and test. Thank you