Phrazor SDK
Get API KeyPhrazor API
  • 👋Welcome
  • Docs
    • ⚡Quick Start
    • 🔑Get your API Key
    • Documentation
      • 📥Download and Import
      • 🔗Connect your Data
      • 🛠️Setup your Analysis
        • Descriptor
        • Change
        • Trend
        • Compare
        • Target vs Achievement
        • Budget vs Expense
        • Others
          • Filter your Data
      • 📋Generate your Insights
      • 📝Generate your Summary
      • 🔌Integrations
      • 💣Rate Limits
Powered by GitBook
On this page
  • Compare by Dimension (compare_dimension)
  • Input Combinations
  • Topics
  • Examples
  • Generate Insights by Analysis
  • Generate Insights by Topics
  • Compare by Metrics
  • Input Combinations
  • Topics
  • Examples
  • Generate Insights by Analysis
  • Generate Insights by Topics
  1. Docs
  2. Documentation
  3. Setup your Analysis

Compare

PreviousTrendNextTarget vs Achievement

Last updated 1 year ago

Compare helps you understand the relationships and variances within your data based on various performance metrics. It focuses on evaluating and contrasting different aspects or entities within a dataset. It enables users to assess the relationships, differences, and similarities between various dimensions, metrics, or entities to draw meaningful insights. Using this, you can examine the comparison between two measures or two values/entities of a dimension.

You can either Compare by Dimension or Compare by Metrics.

Compare by Dimension (compare_dimension)

This analysis combination helps you to compare two values that belong to the same dimension.

Input Combinations

Sr No
Description

1

Date, Metric, Dimension, compare_value_1 and compare_value_2

For all the input combinations mentioned above, you can configure them using the method, with the exception of compare_value_1 and compare_value_2, which should be configured using the method.

Topics

Topic
Description

compare_by_performance

Compares data based on performance metrics.

compare_by_contribution

Compares data based on contribution metrics.

compare_by_rank

Compares data based on rank metrics.

While comparing by dimension, if no compare value parameter is given then the first 2 values from the given data will get picked up.

Examples

Generate Insights by Analysis

Generate insights by comparing the South and West Region based on their weekly Sales

# Set column meta according to the input combination.
phrzr.set_column_meta(
    date_column={"name": "Date", "period": "week"},
    metric_column="Sales",
    dimension_column="Region"
)

insights = phrzr.get_insights(
    'compare_dimension', 
    compare_value_1='South', 
    compare_value_2='West'
)

print(insights)

Generate Insights by Topics

Let's compare South and West Region on the basis of their contribution to weekly Sales.

# Set column meta according to the topic input combination.
phrzr.set_column_meta(
    date_column={"name": "Date", "period": "month"},
    metric_column="Sales",
    dimension_column="Region"
)

insights = phrzr.get_insights(["compare_by_contribution"])

print(insights)

Compare by Metrics

This analysis combination helps you to compare two metrics with or without dimension.

Input Combinations

Sr No
Description

1

Date, Metric 1 and Metric 2

2

Date, Metric 1, Metric 2 and Dimension

Topics

Topic
Description

compare_overall_primary_secondary

Provides insights on comparison between the two metrics. Input - Date, Metric 1 and Metric 2

compare_primary_secondary_dim

Offers insights on comparison between the metrics for the given dimension. Input - Date, Metric 1, Metric 2 and Dimension

compare_other

Gives other miscellaneous insights. Input - Date, Metric 1 and Metric 2 / Date, Metric 1, Metric 2 and Dimension

Examples

Generate Insights by Analysis

Generate insights by comparing the Sales and Profit.

# Set column meta according to the input combination.
phrzr.set_column_meta(
    date_column={"name": "Date", "period": "month"},
    metric_column=["Sales","Profit"]
)

insights = phrzr.get_insights('compare_measure')

print(insights)

You can even compare Sales and Profit Region wise.

# Set column meta according to the input combination.
phrzr.set_column_meta(
    date_column={"name": "Date", "period": "month"},
    metric_column=["Sales","Profit"],
    dimension_column="Region"
)

insights = phrzr.get_insights('compare_measure')

print(insights)

To compare metrics for an individual Region, you can utilize the focus_on_value parameter when calling the get_insights method.

Generate Insights by Topics

Let's gather insights regarding the weekly comparison between Sales and Price.

# Set column meta according to the topic input combination.
phrzr.set_column_meta(
    date_column={"name": "Date", "period": "week"},
    metric_column="Sales"
)

insights = phrzr.get_insights(["compare_overall_primary_secondary"])

print(insights)
🛠️
get_insights
set_column_meta