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
nightfall
Helper I
Helper I

Dynamic P&L and possible relationship issue

Hello everybody!

I have the following issue:
I import the accounts of my clients (table Conti) to our erp in order to prepare their financial statements.
I wanted to prepare some visual with power bi in addition to it.
In addition to the Conti table, where my clients data are stored, i have the BilancioFULL table, with the general charter of accounts of my software, and the "PdC Datev" table, that connects my clients' accounts to the general charter of accounts of my software:
BilancioFULL[Codice] 1-->* PdC Datev[PdC].
PdC Datev[Conto]1-->*Conti[Conto]
(i merged BilancioFULL[Sottocategoria] and PdC Datev[PdC] in 'Conti' afterwards just to make experiments with this issue, but won't work)
'CE2'[Normalized] is related with 'Conti'[Sottocategoria]'CE2'[Normalized] is related with 'Conti'[Sottocategoria]

 

The problem is that i would like that when one of the categories in the P&L are highlighted, in another table should be shown the various accounts in that category. If CE2 stays without relationship, the second table won't of course filter anything.

2.rel.jpg

However, if i connect the CE2[Normalized]1-->*Conti[Sottocategoria] table, the subtotals in green in the picture disappear, but i am able to filter the accounts in the other table.
struc.jpg
highlight.jpg

 

I think this may happen because the subtotals aren't really "translated" by the relationship, as they are part of the [normalized] column (which is simply the P&L template "trimmed") but don't really exist in PdC Datev[PdC], even though they exist in BilancioFULL...
To circumvent this issue I have tried to set the relationship as non-active so that the 3 subtotals in the measure appear (and they do), plus adding USERELATIONSHIP in the CALCULATE to recreate the deactivated relationship just for the explicit Calculate() in the [Valori CE] measure. however if i then click one of the categories in the P&L table, the accounts won't be filtered in the second table.
nightfall_0-1619933659517.png

 

Do you have any idea on where i am wrong?
PS if i make the relationship active and for the subtotals instead of using the measure i try to put e.g.
CurrentItem = "21) Utile (Perdita) dell'esercizio", "AAA"
it appears and shows correctly "AAA"  so I think it's something related to the relationship... only, how can I get around it?
nightfall_1-1619933878604.png

 

Thank you in advance!
Vittorio
1 ACCEPTED SOLUTION
nightfall
Helper I
Helper I

as a follow up, the solution to this issue was switching the focus from the P&L visual to the other "accounts" table: there using an ad-hoc measure:

IF(
HASONEVALUE(),
CALCULATE()

made the trick.
 
Hope this can help other neophytes like me on this subject.

Br,
 
Vittorio
 

View solution in original post

3 REPLIES 3
nightfall
Helper I
Helper I

as a follow up, the solution to this issue was switching the focus from the P&L visual to the other "accounts" table: there using an ad-hoc measure:

IF(
HASONEVALUE(),
CALCULATE()

made the trick.
 
Hope this can help other neophytes like me on this subject.

Br,
 
Vittorio
 
nightfall
Helper I
Helper I

hello @v-lionel-msft and thank you for your much appreciated hint!
I have tried changing the measures, the tables, etc, but without success.

I am really struggling to get the logic behind, because if i activate the relationship the measures of the subtotals don't work anymore, so there might be somehow an implicit filtering that i am not getting.
e.g. the first subtotal that points to '_Base'[Reddito operativo] is:

/* A - B del conto economico*/ CALCULATE ( '_Base'[Risultato d'esercizio], 'BilancioFULL'[Tipo] = "CE", 'Elenco'[Index] < 58 )

that calls [Risultato d'esercizio] which is

'_Base'[Ricavi] + '_Base'[Costi]

 that in turn are:

Ricavi = CALCULATE(SUM(Conti[Saldo finale]), Conti[Natura] = "R", DATESYTD('Date'[Date]))

 

and 

Costi = CALCULATE(SUM(Conti[Saldo finale]), Conti[Natura] = "C", DATESYTD('Date'[Date]))*-1

 

I am really getting crazy i have to admit 🙂

 

Thank you anyway for your comment.

 

Vittorio

v-lionel-msft
Community Support
Community Support

Hi @nightfall ,

 

There seems to be no problem with the model, it may be a problem with the measure formulas.

 

 

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.