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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nicolast29
Helper V
Helper V

How to make a case if for a lot of possibilities

Hi

I import balancesheet from my client, here a example

N°  CompteLibelléDébitCréditDate
10130000CAPITAL APPELE ET VERSE 170960431/12/2020
10611000RESERVE LEGALE 170960.431/12/2020

 

I need to add a column, whith the Cycle for each account number (N° compte),

The account number must be between two values (Compte Début & Compte Fin) in order to determine the Cycle

here a sample 

 

Compte DébutCompte FinCycleCatégorie_bilan
1000000014999999Capitaux propres - Provisions pour risques & chargesCapitaux propres
1500000015299999Capitaux propres - Provisions pour risques & chargesProvisions pour risques & charges 
1500000015499999Capitaux propres - Provisions pour risques & chargesProvisions pour risques & charges 
1530000015399999PersonnelPersonnel
1550000015599999Impôts & TaxesImpôts & Taxes

 

nicolast29_0-1630917813459.png

 

nicolast29_1-1630917829844.png

 

I have more than 55 possibities, that why i don't know who to do in power bi

 

Thanks

2 REPLIES 2
nicolast29
Helper V
Helper V

I add a comment

I was making like this under Excel, but as now i want to import the balancesheet directrly under power bi and made the transformation:

Sub test()
Dim ligne As Integer
    ligne = 1
    Do While Cells(ligne, 1).Value <> ""
        Select Case Cells(ligne, 1).Value
        Case 10000000 To 14999999: Worksheets("Balance N").Cells(ligne, 5).Value = "Capitaux propres"
        Case 15000000 To 15299999: Worksheets("Balance N").Cells(ligne, 5).Value = "Provisions pour risques & charges"
        Case 15400000 To 15499999: Worksheets("Balance N").Cells(ligne, 5).Value = "Provisions pour risques & charges"
        Case 15300000 To 15399999: Worksheets("Balance N").Cells(ligne, 5).Value = "Personnel"
        Case 15500000 To 15599999: Worksheets("Balance N").Cells(ligne, 5).Value = "Impôts & Taxes"
        Case 15600000 To 15999999: Worksheets("Balance N").Cells(ligne, 5).Value = "Provisions pour risques & charges"
        Case 16000000 To 16599999: Worksheets("Balance N").Cells(ligne, 5).Value = "Emprunts & dettes"
        Case 16600000 To 16699999: Worksheets("Balance N").Cells(ligne, 5).Value = "Personnel"
        Case 16700000 To 16999999: Worksheets("Balance N").Cells(ligne, 5).Value = "Emprunts & dettes"
        Case 17000000 To 18999999: Worksheets("Balance N").Cells(ligne, 5).Value = "Immobilisations financières"
        Case 20000000 To 20999999: Worksheets("Balance N").Cells(ligne, 5).Value = "Immobilisations incorporelles"
        Case 21000000 To 23999999: Worksheets("Balance N").Cells(ligne, 5).Value = "Immobilisations corporelles"
        End Select
        ligne = ligne + 1
    Loop
End Sub


Thanks

Hi @nicolast29 ,

 

Have you tried to use USERELATIONSHIP function? It specifies the relationship to be used in a specific calculation as the one that exists between columnName1 and columnName2.

 

 

Best Regards,

Icey

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.