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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sansudhi8
Helper III
Helper III

Distinct count of VisitFID , only of selected Codes

Dear All, 

 

Kindly look into the attached PBI. Could you please help me to add distinct count of VisitFID only of below Charge codes to given Matrix. 

 

PBI

 

  • 99201
    99202
    99203
    99204
    99205
    99202T
    99203T
    99204T
    99205T

Thank you.

Sansudhi. 

1 ACCEPTED SOLUTION

Hi @Sansudhi8 ,

 

Create 2 measures.

Measure = SUM(Sheet1[Total Charge])

Measure 2 = AVERAGEX(VALUES(Sheet1[BeginDateOfService].[Month]),[Measure])

test_Distinct count of VisitFID , only of selected Codes.PNG

 

Best Regards,
Liang
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

9 REPLIES 9
nandic
Memorable Member
Memorable Member

Hi @Sansudhi8 ,

 

Could you try this formula:
New Distinct Count =
CALCULATE (
DISTINCTCOUNT ( Sheet1[VisitFID] ),
Sheet1[ChargeCode]
IN {
"99201",
"99202",
"99203",
"99204",
"99205",
"99202T",
"99203T",
"99204T",
"99205T"
}
)

Cheers,
Nemanja

Hi @nandic 

Great , thank you very much.

 

Is it possible to get Average for Totals. Typically it has Sum .

 

Sansudhi.

Hi @Sansudhi8 ,

 

Is this problem sloved?
If not, please let me know.

 

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

Hi @V-lianl-msft ,

 

I need to show this grand total as a avarage of Jan to Dec. (Total Charge)

 

Im.png

kindly check the 1st attached PBI.

Could you please suggest a solution for this. 

thanks for your time.

Sansudhi. 

Hi @Sansudhi8 ,

 

Create 2 measures.

Measure = SUM(Sheet1[Total Charge])

Measure 2 = AVERAGEX(VALUES(Sheet1[BeginDateOfService].[Month]),[Measure])

test_Distinct count of VisitFID , only of selected Codes.PNG

 

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

Hi @V-lianl-msft ,

 

Thank you very much. 

 

Sansudhi. 

Hi @Sansudhi8 ,

 

Try to create a measure like this:

Average_of_noofVisitFID =
AVERAGEX ( VALUES ( TableName[year_month] ), [_noofVisitFID] )

 

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

BA_Pete
Super User
Super User

Hi @Sansudhi8 ,

 

The following measure should do what you need:

 

 

_noofVisitFID = 
CALCULATE(
    DISTINCTCOUNT(Sheet1[VisitFID]),
    Sheet1[ChargeCode] IN {"99201","99202","99203","99204","99205","99202T","99203T","99204T","99205T"}
)

 

 

 

However, you need to change the data type of VisitFID to Text in Power Query first. You currently have this field set as a numerical data type so there is a type mismatch causing errors.

 

*EDIT* I am assuming that the codes you provided "99201" etc. are visitFID codes. I can't see your source data as I can't access your computer where the source is held.

 

*2nd EDIT* Ignore issue above. I have updated measure code to reference your [ChargeCode] field. I now get the following output:

sansudhi.PNG

 

 

Pete 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hi @BA_Pete ,

 

Great , thank you very much.

 

Is it possible to get Average for Totals. Typically it has Sum .

 

Sansudhi.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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