Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hello Community,
I am trying to Dax the below logic:
Solved! Go to Solution.
Hi @kalkhudary ,
Thanks for your reply and the detailed info. You can update the formula of measure as below:
Measure =
CALCULATE (
SUMX (
Taxes,
Taxes[issuetoemployee]
+ IF ( Taxes[taxIndicator] = "yes", Taxes[taxamount], 0 )
+ IF (
Taxes[EmployerAdvancesIndicator] = "Yes"
&& Taxes[timeline] = 1
&& Taxes[employeractive] = "yes",
Taxes[employeradvancesamount],
0
)
+ IF ( Taxes[SPVIndicator] = "Yes", Taxes[SPVamount], 0 )
+ IF ( Taxes[beneficiary1Indicator] = "Yes", Taxes[beneficiary1amount], 0 )
+ IF ( Taxes[beneficiary2Indicator] = "Yes", Taxes[beneficiary2amount], 0 )
),
Application[CanadianBankAccount] = "No",
Application[DirectPayment] = "No",
'Payment cycle'[PaymentGenerated] = "Yes"
)
Best Regards
Hi @kalkhudary ,
You can create a measure as below to get it:
Measure =
VAR _issueto =
SUM ( 'Taxes'[issuetoemployee] )
VAR _taxamt =
CALCULATE (
SUM ( 'Taxes'[taxamount] ),
FILTER ( 'Taxes', 'Taxes'[taxIndicator] = "Yes" )
)
VAR _empadamt =
CALCULATE (
SUM ( 'Taxes'[employeradvancesamount] ),
FILTER (
'Taxes',
'Taxes'[EmployerAdvancesIndicator] = "Yes"
&& 'Taxes'[timeline] = 1
&& 'Taxes'[employeractive] = "Yes"
)
)
VAR _spvamt =
CALCULATE (
SUM ( 'Taxes'[SPVamount] ),
FILTER ( 'Taxes', 'Taxes'[SPVIndicator] = "Yes" )
)
VAR _b1amt =
CALCULATE (
SUM ( 'Taxes'[beneficiary1amount] ),
FILTER ( 'Taxes', 'Taxes'[beneficiary1Indicator] = "Yes" )
)
VAR _b2amt =
CALCULATE (
SUM ( 'Taxes'[beneficiary1amount] ),
FILTER ( 'Taxes', 'Taxes'[beneficiary2Indicator] = "Yes" )
)
RETURN
_issueto + _taxamt + _empadamt + _spvamt + _b1amt + _b2amt
And for the following conditions, could you please provide more details on it? The 'Application' and 'Payment cycle' are another two tables? Is there any relationship created among these two tables and the table 'Taxes'?
where (Application.CanadianBankAccount = No and Application.DirectPayment = No and Payment cycle.PaymentGenerated = Yes)
If the above one still not help you get the expected result, please provide some raw data in your tables 'taxes','Application' and 'Payment cycle' (exclude sensitive data) with Text format and your expected result with backend logic and special examples.It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
@v-yiruan-msft Thank you. The 1st part is set and looks good. As for the condition that needs to apply on all the above to Sum the Result.
where (Application.CanadianBankAccount = No and Application.DirectPayment = No and Payment batch.PaymentGenerated = Yes)
I have included the below data model I am using. The taxes are included in the payment table which is connected with the application as one-to-one and connected with the payment batch(cycle) as many to one.
Would we inclue it as a VAR where we have an if condition and Sum or a Sum and Filter and how we will include two filter from 2 different tables. I am stuck here now.
Hi @kalkhudary ,
Thanks for your reply and the detailed info. You can update the formula of measure as below:
Measure =
CALCULATE (
SUMX (
Taxes,
Taxes[issuetoemployee]
+ IF ( Taxes[taxIndicator] = "yes", Taxes[taxamount], 0 )
+ IF (
Taxes[EmployerAdvancesIndicator] = "Yes"
&& Taxes[timeline] = 1
&& Taxes[employeractive] = "yes",
Taxes[employeradvancesamount],
0
)
+ IF ( Taxes[SPVIndicator] = "Yes", Taxes[SPVamount], 0 )
+ IF ( Taxes[beneficiary1Indicator] = "Yes", Taxes[beneficiary1amount], 0 )
+ IF ( Taxes[beneficiary2Indicator] = "Yes", Taxes[beneficiary2amount], 0 )
),
Application[CanadianBankAccount] = "No",
Application[DirectPayment] = "No",
'Payment cycle'[PaymentGenerated] = "Yes"
)
Best Regards
@v-yiruan-msft Thanks alot I believe that solves it. QQ: If I want to sum (Taxes.issuetoemployee + Taxes.taxamount ) Under the condition( taxes.taxIndicator = yes) instead of the below logic. How would I flip it to say Caluclate(SumX( Taxes, Taxes[issuet to employee] +[Taxes.taxamount], if(Taxes[Tax Indictor]="Yes", 0)
This section only
CALCULATE ( SUMX ( Taxes, Taxes[issuetoemployee] + IF ( Taxes[taxIndicator] = "yes", Taxes[taxamount], 0 )
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.