Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Polar_A
Helper I
Helper I

DAX calculations

Hi I need help with some Dax queries.

Esentially I would like the dax to provide me a count of credit values per therapy and referring establishment, instead of it repeating for every single value.

 

The Dax code that I am using is:

CreditNoteValues =
CALCULATE(
    COUNTROWS('Cust Invoice Journal'),
    'Cust Invoice Journal'[invoiceamount] < 0,
    FILTER(
        _2_gold_prescriptions,
        _2_gold_prescriptions[clu_therapyidname] = SELECTEDVALUE(_2_gold_prescriptions[clu_therapyidname])
    ),
    FILTER(
        _2_gold_patients,
        _2_gold_patients[clu_referringestablishmentidname] = SELECTEDVALUE(_2_gold_patients[clu_referringestablishmentidname])
    )
)

Polar_A_0-1726520694263.png

 
 
KR.

PolarA
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Polar_A 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1726540700141.png

2. Below are the measure I've created for your needs:

MEASURE =
CALCULATE (
    SUM ( 'Table'[CreditNoteValues] ),
    FILTER (
        'Table',
        'Table'[Referring Establishment] = MAX ( 'Table'[Referring Establishment] )
            && 'Table'[Therapy] = MAX ( 'Table'[Therapy] )
    )
)

Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_1-1726540737981.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
 

Take care to remove sensitive data.

 

For questions about uploading data, you can try the following links:

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Solved: How to upload PBI in Community - Microsoft Fabric Community

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

1 REPLY 1
Anonymous
Not applicable

Hi, @Polar_A 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1726540700141.png

2. Below are the measure I've created for your needs:

MEASURE =
CALCULATE (
    SUM ( 'Table'[CreditNoteValues] ),
    FILTER (
        'Table',
        'Table'[Referring Establishment] = MAX ( 'Table'[Referring Establishment] )
            && 'Table'[Therapy] = MAX ( 'Table'[Therapy] )
    )
)

Here's my final result, which I hope meets your requirements.

 

vlinyulumsft_1-1726540737981.png

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.
 

Take care to remove sensitive data.

 

For questions about uploading data, you can try the following links:

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Solved: How to upload PBI in Community - Microsoft Fabric Community

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.