Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
4 years ago
Solved

joining tables or measures

Comrades good day: I have a problem with a result that I have not been able to obtain. I have two tables with shops and cities. The first table is where the stores make a presence with sales ...
  • Syndicate_Admin's avatar
    4 years ago

    Let's see if this works for you.

    First create dimension tables for Stores and Cities. The model looks like this:

    model.jpgAnd it creates the following measures:

    For the number of physical stores

    Tiendas Físicas = 
    DISTINCTCOUNT('Listado de Tiendas'[Ciudad])

    For the number of cities with presences

    Ciudades con Ventas = 
    DISTINCTCOUNT('Ventas'[Ciudad])

    And for the total calculation

    Total =
    VAR FT =
        VALUES ( 'Listado de Tiendas'[Ciudad] )
    VAR CV =
        VALUES ( Ventas[Ciudad] )
    RETURN
        COUNTROWS ( DISTINCT ( UNION ( FT, CV ) ) )
    

    result.jpg

    I attach the sample PBIX file