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
Bobbo
Regular Visitor

Percentage Between 2 Filtered Values

Hello, I need to calculate the % difference from two card visuals, each have filtered values. I would like to display the % in a new Card visual.

 

'DimPolicy'[PolicyDateCreated] is the table and variable representing subscriptions. I have a Card visual for date ranges in 2020 and a Card visual for date ranges in 2019. On a side note, I need to do this on a month by month comparison year over year as well as full year comparisons for 2020 and 2019.

 

Could I use something like this? 

 

Count of PolicyNumber % difference from Count of PolicyNumber =
VAR __BASELINE_VALUE = COUNTA('DimPolicy'[PolicyNumber]) , (DATESINPERIOD ('DimPolicy'[PolicyDateCreated], DATE (2019,1,9), DATE (2019,30,9) ))
VAR __VALUE_TO_COMPARE = COUNTA('DimPolicy'[PolicyNumber]) , (DATESINPERIOD ('DimPolicy'[PolicyDateCreated], DATE (2020,1,9), DATE (2020,30,9) ))
RETURN
    IF(
        NOT ISBLANK(__VALUE_TO_COMPARE),
        DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
    )

 

 

Thanks.

 

 

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Bobbo,

Did these card visual filters are used the same data source field? If this is a case, you can't compare the difference based on same filter. (current you can't extract different values from files with the same data source field)
You need to duplicate that field to create a new table as a source of one filter, then you can compare the difference between two filters.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
MFelix
Super User
Super User

Hi @Bobbo ,

 

Don't know how your model looks like but the syntax seems fine, however if you want to have something more dinamic you need to change the filter part of your measure from a static values of date to something that picks up your values.

 

Can you please share a mockup data or sample of your PBIX file and expected result. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.