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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.